Produced by Araxis Merge on 1/4/2018 4:54:41 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | CHAMPVA_Benefit_Eligibility_v1.0.0.zip\webservice\champvapay-service\src\test\java\gov\va\med\mbcp\champva\dao\impl | ChampVAPayDAOTest.java | Thu Dec 21 19:52:28 2017 UTC |
| 2 | CHAMPVA_Benefit_Eligibility_v1.0.0.zip\webservice\champvapay-service\src\test\java\gov\va\med\mbcp\champva\dao\impl | ChampVAPayDAOTest.java | Thu Jan 4 21:01:21 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 782 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * The pac kage gov.v a.med.mbcp .champva.d ao.impl co ntains cla sses imple menting th e Interfac es for ret rieval | |
| 3 | * of CHAM PVA Pay Re sults in t he target VistA inst ance. | |
| 4 | * | |
| 5 | * Includi ng the uni t tests in the same package as the class es under t est allows test case s access t o | |
| 6 | * friendl y and prot ected memb ers, witho ut breakin g encapsul ation. | |
| 7 | * | |
| 8 | */ | |
| 9 | package go v.va.med.m bcp.champv a.dao.impl ; | |
| 10 | ||
| 11 | import sta tic gov.va .med.mbac. vlh.impl.T estVistaLi nkHelper.I NST_MAP_NO T_FOUND_EX CEPTION; | |
| 12 | import sta tic gov.va .med.mbac. vlh.impl.T estVistaLi nkHelper.I NST_MAP_NO T_INIT_EXC EPTION; | |
| 13 | import sta tic gov.va .med.mbac. vlh.impl.T estVistaLi nkHelper.N AMING_EXCE PTION; | |
| 14 | import sta tic gov.va .med.mbac. vlh.impl.T estVistaLi nkHelper.R ESOURCE_EX CEPTION; | |
| 15 | import sta tic org.ju nit.Assert .assertEqu als; | |
| 16 | import sta tic org.ju nit.Assert .assertNot Null; | |
| 17 | import sta tic org.ju nit.Assert .assertNul l; | |
| 18 | import sta tic org.ju nit.Assert .assertTru e; | |
| 19 | import sta tic org.ju nit.Assert .fail; | |
| 20 | import sta tic org.mo ckito.Mock ito.doThro w; | |
| 21 | import sta tic org.mo ckito.Mock ito.times; | |
| 22 | import sta tic org.mo ckito.Mock ito.verify ; | |
| 23 | import sta tic org.mo ckito.Mock ito.when; | |
| 24 | ||
| 25 | import jav ax.resourc e.Resource Exception; | |
| 26 | ||
| 27 | import org .junit.Aft er; | |
| 28 | import org .junit.Bef ore; | |
| 29 | import org .junit.Tes t; | |
| 30 | import org .springfra mework.bea ns.BeansEx ception; | |
| 31 | import org .springfra mework.con text.suppo rt.ClassPa thXmlAppli cationCont ext; | |
| 32 | ||
| 33 | import gov .va.med.ex ception.Fo undationsE xception; | |
| 34 | import gov .va.med.mb ac.vlh.com mon.IVista LinkHelper ; | |
| 35 | import gov .va.med.mb ac.vlh.imp l.TestVist aLinkHelpe r; | |
| 36 | import gov .va.med.mb cp.champva .dao.commo n.IChampVA PayDAO; | |
| 37 | import gov .va.med.mb cp.champva .domain.co mmon.ICode Result; | |
| 38 | import gov .va.med.mb cp.champva .domain.im pl.ChampVA Exception; | |
| 39 | import gov .va.med.mb cp.champva .domain.im pl.CodeRes ult; | |
| 40 | import gov .va.med.vi stalink.ad apter.cci. VistaLinkC onnection; | |
| 41 | import gov .va.med.vi stalink.ad apter.reco rd.VistaLi nkFaultExc eption; | |
| 42 | import gov .va.med.vi stalink.rp c.RpcReque st; | |
| 43 | import gov .va.med.vi stalink.rp c.RpcRespo nse; | |
| 44 | ||
| 45 | /** | |
| 46 | * Test cl ass for Ch ampVAPayDA O. | |
| 47 | * | |
| 48 | * @author PII | |
| 49 | * @versio n 1.0.0 | |
| 50 | */ | |
| 51 | public cla ss ChampVA PayDAOTest { | |
| 52 | ||
| 53 | privat e static f inal Strin g RPC_NAME = "CHSRVL KP VALIDCD "; | |
| 54 | ||
| 55 | privat e static f inal Strin g APP_PROX Y_NAME = " CHAMPVAPAY ,APPLICATI ON PROXY"; | |
| 56 | ||
| 57 | privat e static f inal Strin g SITE_ID = "500"; | |
| 58 | ||
| 59 | privat e static f inal Strin g NO_RESUL T = "No"; | |
| 60 | ||
| 61 | privat e static f inal Strin g YES_RESU LT = "Yes" ; | |
| 62 | ||
| 63 | privat e static f inal Strin g CONDITIO NAL_RESULT = "Yes^I can't love ya 'cause your feet 's too BIG !"; | |
| 64 | ||
| 65 | privat e static f inal Strin g ICD9 = " 253.8"; // condition al | |
| 66 | ||
| 67 | privat e static f inal Strin g NDC = "5 5700-0373- 30"; // "N o" | |
| 68 | ||
| 69 | privat e static f inal Strin g CPT = "9 8941"; // "Yes" | |
| 70 | ||
| 71 | privat e ClassPat hXmlApplic ationConte xt context = null; | |
| 72 | ||
| 73 | @Befor e | |
| 74 | public void setU p() throws Exception { | |
| 75 | th is.context = new Cla ssPathXmlA pplication Context("/ champvaTes tBeans.xml "); | |
| 76 | } | |
| 77 | ||
| 78 | @After | |
| 79 | public void tear Down() thr ows Except ion { | |
| 80 | th is.context .close(); | |
| 81 | th is.context = null; | |
| 82 | } | |
| 83 | ||
| 84 | /** | |
| 85 | * Tes ts for Spr ing DI | |
| 86 | */ | |
| 87 | ||
| 88 | /** | |
| 89 | * Tes t lazy ins tantiation of vistaL inkHelper | |
| 90 | */ | |
| 91 | @Test | |
| 92 | public final voi d testVist aLinkHelpe rInjection () { | |
| 93 | IV istaLinkHe lper vista LinkHelper = (TestVi staLinkHel per) conte xt.getBean ("vistaLin kHelper"); | |
| 94 | as sertNotNul l("vistaLi nkHelper f ailed to i nstantiate .", vistaL inkHelper) ; | |
| 95 | as sertTrue(" vistaLinkH elper inst ance of Te stVistaLin kHelper.", | |
| 96 | (vis taLinkHelp er instanc eof TestVi staLinkHel per)); | |
| 97 | } | |
| 98 | ||
| 99 | /** | |
| 100 | * Tes t lazy ins tantiation of champV APayDAO, a s well as getAppProx yName() | |
| 101 | * and getSiteId () methods | |
| 102 | */ | |
| 103 | @Test | |
| 104 | public final voi d testCham pVAPayDAOI njection() { | |
| 105 | IC hampVAPayD AO champVA PayDAO = ( ChampVAPay DAO) conte xt.getBean ("champVAP ayDAO"); | |
| 106 | as sertNotNul l("champVA PayDAO fai led to ins tantiate." , champVAP ayDAO); | |
| 107 | as sertEquals (APP_PROXY _NAME, ((C hampVAPayD AO) champV APayDAO).g etAppProxy Name()); | |
| 108 | as sertEquals (SITE_ID, ((ChampVAP ayDAO) cha mpVAPayDAO ).getSiteI d()); | |
| 109 | } | |
| 110 | ||
| 111 | /** | |
| 112 | * *** Tests for getCodeRe sult metho d *** | |
| 113 | */ | |
| 114 | ||
| 115 | /** | |
| 116 | * Ver ify that g etCodeResu lt() calls | |
| 117 | * vis taLinkConn ection.exe cuteRPC(rp cRequest) once | |
| 118 | * rpc Request.se tRpcName(" CHSRVLKP V ALIDCD") o nce rpcReq uest.clear Params() | |
| 119 | * onc e rpcRespo nse.getRes ults() onc e | |
| 120 | */ | |
| 121 | @Test | |
| 122 | public void veri fyGetCodeR esultsCall s() { | |
| 123 | tr y { | |
| 124 | ||
| 125 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 126 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 127 | ||
| 128 | RpcReque st mockedR eq = ((Tes tVistaLink Helper) vi staLinkHel per).getMo ckedReq(); | |
| 129 | VistaLin kConnectio n mockedVl c = ((Test VistaLinkH elper) vis taLinkHelp er).getMoc kedVlc(); | |
| 130 | RpcRespo nse mocked Resp = ((T estVistaLi nkHelper) vistaLinkH elper).get MockedResp (); | |
| 131 | when(moc kedResp.ge tResults() ).thenRetu rn(CONDITI ONAL_RESUL T); | |
| 132 | when(moc kedVlc.exe cuteRPC(mo ckedReq)). thenReturn (mockedRes p); | |
| 133 | ||
| 134 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("ICD- 9", ICD9); | |
| 135 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"ICD 9\", \"" + ICD9 + "\ ") returne d void", c odeResult) ; | |
| 136 | ||
| 137 | verify(m ockedVlc, times(1)). executeRPC (mockedReq ); | |
| 138 | verify(m ockedReq, times(1)). setRpcName (RPC_NAME) ; | |
| 139 | verify(m ockedReq, times(1)). clearParam s(); | |
| 140 | verify(m ockedResp, times(1)) .getResult s(); | |
| 141 | ||
| 142 | } catch (Fou ndationsEx ception e) { | |
| 143 | fail(e.g etMessage( )); | |
| 144 | } catch (Bea nsExceptio n e) { | |
| 145 | fail(e.g etMessage( )); | |
| 146 | } catch (Cha mpVAExcept ion e) { | |
| 147 | fail(e.g etMessage( )); | |
| 148 | } | |
| 149 | } | |
| 150 | ||
| 151 | /** | |
| 152 | * Ver ify that g etCodeResu lt() retur ns valid C odeResult when RPC c all result | |
| 153 | * is valid. | |
| 154 | * | |
| 155 | */ | |
| 156 | @Test | |
| 157 | public void veri fyThatGetC odeResultR eturnsVali dCodeResul t() { | |
| 158 | IC odeResult expRes = n ew CodeRes ult(NO_RES ULT); | |
| 159 | tr y { | |
| 160 | ||
| 161 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 162 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 163 | ||
| 164 | RpcReque st mockedR eq = ((Tes tVistaLink Helper) vi staLinkHel per).getMo ckedReq(); | |
| 165 | VistaLin kConnectio n mockedVl c = ((Test VistaLinkH elper) vis taLinkHelp er).getMoc kedVlc(); | |
| 166 | RpcRespo nse mocked Resp = ((T estVistaLi nkHelper) vistaLinkH elper).get MockedResp (); | |
| 167 | when(moc kedResp.ge tResults() ).thenRetu rn(NO_RESU LT); | |
| 168 | when(moc kedVlc.exe cuteRPC(mo ckedReq)). thenReturn (mockedRes p); | |
| 169 | ||
| 170 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("CPT" , CPT); | |
| 171 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"CPT \", \"" + CPT + "\") returned void", cod eResult); | |
| 172 | ||
| 173 | assertEq uals(expRe s, codeRes ult); | |
| 174 | } catch (Fou ndationsEx ception e) { | |
| 175 | fail(e.g etMessage( )); | |
| 176 | } catch (Bea nsExceptio n e) { | |
| 177 | fail(e.g etMessage( )); | |
| 178 | } catch (Cha mpVAExcept ion e) { | |
| 179 | fail(e.g etMessage( )); | |
| 180 | } | |
| 181 | } | |
| 182 | ||
| 183 | /** | |
| 184 | * Ver ify that g etCodeResu lt() retur ns null Co deResult w hen getCon nection() | |
| 185 | * ret urns null connection . | |
| 186 | * | |
| 187 | */ | |
| 188 | @Test | |
| 189 | public void veri fyThatGetC odeResultR eturnsNull CallResult WhenGetCon nectionFai ls() { | |
| 190 | tr y { | |
| 191 | ||
| 192 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 193 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 194 | ((TestVi staLinkHel per) vista LinkHelper ).setMocke dVlc(null) ; | |
| 195 | ||
| 196 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("NDC" , NDC); | |
| 197 | assertNu ll("champV APayDAO.ge tCodeResul t(\"NDC\", \"" + NDC + "\") re turned voi d", codeRe sult); | |
| 198 | ||
| 199 | } catch (Bea nsExceptio n e) { | |
| 200 | fail(e.g etMessage( )); | |
| 201 | } catch (Cha mpVAExcept ion e) { | |
| 202 | fail(e.g etMessage( )); | |
| 203 | } | |
| 204 | } | |
| 205 | ||
| 206 | /** | |
| 207 | * Ver ify that g etCodeResu lt() throw s ChampVAR esourceExc eption whe n RPC call | |
| 208 | * ret urns empty String | |
| 209 | * | |
| 210 | */ | |
| 211 | @Test | |
| 212 | public void veri fyThatGetC odeResultT hrowsChamp VAResource ExceptionW henRpcRetu rnsEmptySt ring() { | |
| 213 | ||
| 214 | tr y { | |
| 215 | ||
| 216 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 217 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 218 | ||
| 219 | RpcReque st mockedR eq = ((Tes tVistaLink Helper) vi staLinkHel per).getMo ckedReq(); | |
| 220 | VistaLin kConnectio n mockedVl c = ((Test VistaLinkH elper) vis taLinkHelp er).getMoc kedVlc(); | |
| 221 | RpcRespo nse mocked Resp = ((T estVistaLi nkHelper) vistaLinkH elper).get MockedResp (); | |
| 222 | when(moc kedResp.ge tResults() ).thenRetu rn(""); | |
| 223 | when(moc kedVlc.exe cuteRPC(mo ckedReq)). thenReturn (mockedRes p); | |
| 224 | ||
| 225 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("ICD- 9", ICD9); | |
| 226 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"ICD 9\", \"253 .8\") retu rned void" , codeResu lt); | |
| 227 | ||
| 228 | } catch (Fou ndationsEx ception e) { | |
| 229 | fail(e.g etMessage( )); | |
| 230 | } catch (Bea nsExceptio n e) { | |
| 231 | fail(e.g etMessage( )); | |
| 232 | } catch (Cha mpVAExcept ion e) { | |
| 233 | assertEq uals(Champ VAExceptio n.RESOURCE _EXCEPTION , e.getErr orCode()); | |
| 234 | } | |
| 235 | } | |
| 236 | ||
| 237 | /** | |
| 238 | * Ver ify that g etCodeResu lt() throw s ChampVAF oundations Exception when | |
| 239 | * get Connection throws In stitutionM apNotIniti alizedExce ption | |
| 240 | */ | |
| 241 | @Test | |
| 242 | public void veri fyThatGetC odeResultR ethrowsFou ndationsEx ceptionWhe nInstMapNo tInit() { | |
| 243 | tr y { | |
| 244 | ||
| 245 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 246 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 247 | ((TestVi staLinkHel per) vista LinkHelper ).setConne ctionFailC ondition(I NST_MAP_NO T_INIT_EXC EPTION); | |
| 248 | ((TestVi staLinkHel per) vista LinkHelper ).setMocke dVlc(null) ; | |
| 249 | ||
| 250 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("ICD- 9", ICD9); | |
| 251 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"ICD 9\", \"253 .8\") retu rned void" , codeResu lt); | |
| 252 | ||
| 253 | } catch (Bea nsExceptio n e) { | |
| 254 | fail(e.g etMessage( )); | |
| 255 | } catch (Cha mpVAExcept ion e) { | |
| 256 | assertEq uals(Champ VAExceptio n.FOUNDATI ONS_EXCEPT ION, e.get ErrorCode( )); | |
| 257 | } | |
| 258 | } | |
| 259 | ||
| 260 | /** | |
| 261 | * Ver ify that g etCodeResu lt() throw s ChampVAE xception w hen getCon nection | |
| 262 | * thr ows Instit utionMappi ngNotFound Exception | |
| 263 | */ | |
| 264 | @Test | |
| 265 | public void veri fyThatGetC odeResultT hrowsChamp VAExceptio nWhenInstM apNotFound () { | |
| 266 | tr y { | |
| 267 | ||
| 268 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 269 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 270 | ((TestVi staLinkHel per) vista LinkHelper ).setConne ctionFailC ondition(I NST_MAP_NO T_FOUND_EX CEPTION); | |
| 271 | ((TestVi staLinkHel per) vista LinkHelper ).setMocke dVlc(null) ; | |
| 272 | ||
| 273 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("ICD- 9", ICD9); | |
| 274 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"ICD 9\", \"253 .8\") retu rned void" , codeResu lt); | |
| 275 | ||
| 276 | } catch (Bea nsExceptio n e) { | |
| 277 | fail(e.g etMessage( )); | |
| 278 | } catch (Cha mpVAExcept ion e) { | |
| 279 | assertEq uals(Champ VAExceptio n.FOUNDATI ONS_EXCEPT ION, e.get ErrorCode( )); | |
| 280 | } | |
| 281 | } | |
| 282 | ||
| 283 | /** | |
| 284 | * Ver ify that g etCodeResu lt() throw s ChampVAE xception w hen getCon nection | |
| 285 | * thr ows Naming Exception | |
| 286 | */ | |
| 287 | @Test | |
| 288 | public void veri fyThatGetC odeResultT hrowsChamp VAExceptio nWhenNamin gException () { | |
| 289 | tr y { | |
| 290 | ||
| 291 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 292 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 293 | ((TestVi staLinkHel per) vista LinkHelper ).setConne ctionFailC ondition(N AMING_EXCE PTION); | |
| 294 | ((TestVi staLinkHel per) vista LinkHelper ).setMocke dVlc(null) ; | |
| 295 | ||
| 296 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("ICD- 9", ICD9); | |
| 297 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"ICD 9\", \"253 .8\") retu rned void" , codeResu lt); | |
| 298 | ||
| 299 | } catch (Bea nsExceptio n e) { | |
| 300 | fail(e.g etMessage( )); | |
| 301 | } catch (Cha mpVAExcept ion e) { | |
| 302 | assertEq uals(Champ VAExceptio n.NAMING_E XCEPTION, e.getError Code()); | |
| 303 | } | |
| 304 | } | |
| 305 | ||
| 306 | /** | |
| 307 | * Ver ify that g etCodeResu lt() throw s ChampVAE xception w hen getCon nection | |
| 308 | * thr ows Resour ceExceptio n | |
| 309 | */ | |
| 310 | @Test | |
| 311 | public void veri fyThatGetC odeResultT hrowsChamp VAExceptio nWhenResou rceExcepti on() { | |
| 312 | tr y { | |
| 313 | ||
| 314 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 315 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 316 | ((TestVi staLinkHel per) vista LinkHelper ).setConne ctionFailC ondition(R ESOURCE_EX CEPTION); | |
| 317 | ((TestVi staLinkHel per) vista LinkHelper ).setMocke dVlc(null) ; | |
| 318 | ||
| 319 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("ICD- 9", ICD9); | |
| 320 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"ICD 9\", \"253 .8\") retu rned void" , codeResu lt); | |
| 321 | ||
| 322 | } catch (Bea nsExceptio n e) { | |
| 323 | fail(e.g etMessage( )); | |
| 324 | } catch (Cha mpVAExcept ion e) { | |
| 325 | assertEq uals(Champ VAExceptio n.RESOURCE _EXCEPTION , e.getErr orCode()); | |
| 326 | } | |
| 327 | } | |
| 328 | ||
| 329 | /** | |
| 330 | * Ver ify that g etCodeResu lt() throw s ChampVAE xception w hen execut eRPC | |
| 331 | * thr ows VistaL inkFaultEx ception | |
| 332 | */ | |
| 333 | @Test | |
| 334 | public void veri fyThatGetC odeResultT hrowsChamp VAExceptio nWhenVista LinkFaultE xception() { | |
| 335 | tr y { | |
| 336 | ||
| 337 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 338 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 339 | ||
| 340 | RpcReque st mockedR eq = ((Tes tVistaLink Helper) vi staLinkHel per).getMo ckedReq(); | |
| 341 | VistaLin kConnectio n mockedVl c = ((Test VistaLinkH elper) vis taLinkHelp er).getMoc kedVlc(); | |
| 342 | RpcRespo nse mocked Resp = ((T estVistaLi nkHelper) vistaLinkH elper).get MockedResp (); | |
| 343 | when(moc kedResp.ge tResults() ).thenRetu rn(YES_RES ULT); | |
| 344 | when(moc kedVlc.exe cuteRPC(mo ckedReq)). thenThrow( new VistaL inkFaultEx ception("B AZINGA!")) ; | |
| 345 | ||
| 346 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("ICD- 9", ICD9); | |
| 347 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"ICD 9\", \"253 .8\") retu rned void" , codeResu lt); | |
| 348 | ||
| 349 | } catch (Vis taLinkFaul tException e) { | |
| 350 | fail(e.g etMessage( )); | |
| 351 | } catch (Fou ndationsEx ception e) { | |
| 352 | fail(e.g etMessage( )); | |
| 353 | } catch (Bea nsExceptio n e) { | |
| 354 | fail(e.g etMessage( )); | |
| 355 | } catch (Cha mpVAExcept ion e) { | |
| 356 | assertEq uals(Champ VAExceptio n.VISTALIN K_FAULT_EX CEPTION, e .getErrorC ode()); | |
| 357 | } | |
| 358 | } | |
| 359 | ||
| 360 | /** | |
| 361 | * Ver ify that g etCodeResu lt() throw s ChampVAE xception w hen connec tion.close | |
| 362 | * thr ows Resour ceExceptio n | |
| 363 | */ | |
| 364 | @Test | |
| 365 | public void veri fyGetCodeR esultThrow sResourceE xceptionWh enConnecti onCloseFai ls() { | |
| 366 | tr y { | |
| 367 | ||
| 368 | IChampVA PayDAO cha mpVAPayDAO = (ChampV APayDAO) c ontext.get Bean("cham pVAPayDAO" ); | |
| 369 | IVistaLi nkHelper v istaLinkHe lper = (Te stVistaLin kHelper) c ontext.get Bean("vist aLinkHelpe r"); | |
| 370 | ||
| 371 | RpcReque st mockedR eq = ((Tes tVistaLink Helper) vi staLinkHel per).getMo ckedReq(); | |
| 372 | VistaLin kConnectio n mockedVl c = ((Test VistaLinkH elper) vis taLinkHelp er).getMoc kedVlc(); | |
| 373 | RpcRespo nse mocked Resp = ((T estVistaLi nkHelper) vistaLinkH elper).get MockedResp (); | |
| 374 | when(moc kedResp.ge tResults() ).thenRetu rn(NO_RESU LT); | |
| 375 | when(moc kedVlc.exe cuteRPC(mo ckedReq)). thenReturn (mockedRes p); | |
| 376 | doThrow( new Resour ceExceptio n("URP!")) .when(mock edVlc).clo se(); | |
| 377 | ||
| 378 | ICodeRes ult codeRe sult = cha mpVAPayDAO .getCodeRe sult("ICD- 9", ICD9); | |
| 379 | assertNo tNull("cha mpVAPayDAO .getCodeRe sult(\"ICD 9\", \"253 .8\") retu rned void" , codeResu lt); | |
| 380 | ||
| 381 | } catch (Fou ndationsEx ception e) { | |
| 382 | fail(e.g etMessage( )); | |
| 383 | } catch (Bea nsExceptio n e) { | |
| 384 | fail(e.g etMessage( )); | |
| 385 | } catch (Res ourceExcep tion e) { | |
| 386 | fail(e.g etMessage( )); | |
| 387 | } catch (Cha mpVAExcept ion e) { | |
| 388 | assertEq uals(Champ VAExceptio n.RESOURCE _EXCEPTION , e.getErr orCode()); | |
| 389 | } | |
| 390 | } | |
| 391 | ||
| 392 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.