Produced by Araxis Merge on 6/9/2017 3:51:23 PM Eastern Daylight 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 | Fri Jun 9 19:51:23 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-svc-facility\src\test\java\gov\va\nvap\svc\facility\test | FacilityImplTest.java | Fri Apr 21 20:03:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 264 |
| 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 | * To chan ge this te mplate, ch oose Tools | Templat es | |||||
| 3 | * and ope n the temp late in th e editor. | |||||
| 4 | */ | |||||
| 5 | package go v.va.nvap. svc.facili ty.test; | |||||
| 6 | ||||||
| 7 | import gov .va.nvap.s vc.facilit y.data.Fac ility; | |||||
| 8 | import gov .va.nvap.s vc.facilit y.data.Loc ation; | |||||
| 9 | import gov .va.nvap.s vc.facilit y.intf.Ent ityDoesNot ExistExcep tion; | |||||
| 10 | import gov .va.nvap.s vc.facilit y.intf.Fac ilityServi ce; | |||||
| 11 | import gov .va.nvap.s vc.facilit y.impl.Fac ilityServi ceImpl; | |||||
| 12 | import gov .va.nvap.s vc.facilit y.jpa.impl .FacilityJ paControll er; | |||||
| 13 | import gov .va.nvap.s vc.facilit y.jpa.impl .LocationJ paControll er; | |||||
| 14 | ||||||
| 15 | import jav a.util.Col lection; | |||||
| 16 | import jav a.util.Has hMap; | |||||
| 17 | import jav a.util.Map ; | |||||
| 18 | ||||||
| 19 | import jav ax.persist ence.Entit yManager; | |||||
| 20 | import jav ax.persist ence.Entit yManagerFa ctory; | |||||
| 21 | import jav ax.persist ence.Persi stence; | |||||
| 22 | ||||||
| 23 | import jun it.framewo rk.Assert; | |||||
| 24 | import org .junit.Aft er; | |||||
| 25 | ||||||
| 26 | import org .junit.Bef ore; | |||||
| 27 | import org .junit.Tes t; | |||||
| 28 | /** | |||||
| 29 | * | |||||
| 30 | * @author Anand Sas try | |||||
| 31 | */ | |||||
| 32 | public cla ss Facilit yImplTest { | |||||
| 33 | ||||||
| 34 | privat e static E ntityManag erFactory emf = Pers istence.cr eateEntity ManagerFac tory("nwhi n_vap_fac_ loc"); | |||||
| 35 | privat e EntityMa nager em = null; | |||||
| 36 | privat e Facility Service fa cilityServ ice; | |||||
| 37 | ||||||
| 38 | @Befor e | |||||
| 39 | public void setU p() throws Exception { | |||||
| 40 | ||||||
| 41 | // Initializ e Entity M anagers | |||||
| 42 | th is.em = em f.createEn tityManage r(); | |||||
| 43 | ||||||
| 44 | // Initializ e JPA DAO Controller s | |||||
| 45 | Fa cilityJpaC ontroller facilityJp aControlle r = new Fa cilityJpaC ontroller( ); | |||||
| 46 | fa cilityJpaC ontroller. setEntityM anager(em) ; | |||||
| 47 | ||||||
| 48 | Lo cationJpaC ontroller locationJp aControlle r = new Lo cationJpaC ontroller( ); | |||||
| 49 | lo cationJpaC ontroller. setEntityM anager(em) ; | |||||
| 50 | ||||||
| 51 | // Initializ e FactoryS erviceImpl with DAO Controller s | |||||
| 52 | Fa cilityServ iceImpl fa cilityServ iceImpl = new Facili tyServiceI mpl(); | |||||
| 53 | fa cilityServ iceImpl.se tFacilityC ontroller( facilityJp aControlle r); | |||||
| 54 | fa cilityServ iceImpl.se tLocationC ontroller( locationJp aControlle r); | |||||
| 55 | ||||||
| 56 | Ma p testUser sAndFacili ties = new HashMap() ; | |||||
| 57 | te stUsersAnd Facilities .put("webl ogic", "99 8"); | |||||
| 58 | fa cilityServ iceImpl.se tTestUsers AndFacilit ies(testUs ersAndFaci lities); | |||||
| 59 | ||||||
| 60 | ||||||
| 61 | // Associate FactorySe rviceImpl with Facto ryService | |||||
| 62 | th is.facilit yService = facilityS erviceImpl ; | |||||
| 63 | } | |||||
| 64 | ||||||
| 65 | @After | |||||
| 66 | public void tear Down() | |||||
| 67 | { | |||||
| 68 | if ( this.em != null) | |||||
| 69 | { | |||||
| 70 | this.em. close(); | |||||
| 71 | this.em = null; | |||||
| 72 | } | |||||
| 73 | } | |||||
| 74 | @Test | |||||
| 75 | public void test GetAllVist AFacilitie s() { | |||||
| 76 | ||||||
| 77 | Co llection<F acility> f acilities = facility Service.ge tAllVistAF acilities( ); | |||||
| 78 | As sert.asser tNotNull(f acilities) ; | |||||
| 79 | Sy stem.out.p rintln("te stGetAllVi stAFacilit ies - All Facilities count - [ " + facili ties.size( ) + "]. ") ; | |||||
| 80 | As sert.asser tFalse(fac ilities.is Empty()); | |||||
| 81 | } | |||||
| 82 | ||||||
| 83 | @Test | |||||
| 84 | public void test GetAllowed VistAFacil ities() { | |||||
| 85 | ||||||
| 86 | Co llection<F acility> f acilities = facility Service.ge tAllowedVi stAFacilit ies(); | |||||
| 87 | Sy stem.out.p rintln("te stGetAllow edVistAFac ilities - Supported Facilities - " + fac ilities); | |||||
| 88 | As sert.asser tNotNull(f acilities) ; | |||||
| 89 | As sert.asser tFalse(fac ilities.is Empty()); | |||||
| 90 | } | |||||
| 91 | ||||||
| 92 | @Test | |||||
| 93 | public void test GetFacilit yByStation Number() { | |||||
| 94 | Fa cility fac ility = nu ll; | |||||
| 95 | tr y { | |||||
| 96 | facility = facilit yService.g etFacility ByStationN umber("983 "); | |||||
| 97 | } catch (Exc eption e) { | |||||
| 98 | Asse rt.fail("t estGetFaci lityByStat ionNumber - Unexpect ed Excepti on - [" + e.getMessa ge() + "]. "); | |||||
| 99 | } | |||||
| 100 | As sert.asser tNotNull(f acility); | |||||
| 101 | Sy stem.out.p rintln("te stGetFacil ityByStati onNumber - Facility - [" +faci lity.getFa cilityStat ion() + "] . "); | |||||
| 102 | As sert.asser tFalse(!"9 83".equals (facility. getFacilit yStation() )); | |||||
| 103 | } | |||||
| 104 | ||||||
| 105 | @Test | |||||
| 106 | public void test GetFacilit yByStation NumberWith EmptyInput () { | |||||
| 107 | ||||||
| 108 | tr y { | |||||
| 109 | Facility facility = facility Service.ge tFacilityB yStationNu mber(""); | |||||
| 110 | } catch (Ill egalArgume ntExceptio n e) { | |||||
| 111 | Syst em.out.pri ntln("test GetFacilit yByStation NumberWith EmptyInput - Service Exception Message - [" + e.ge tMessage() + "]. "); | |||||
| 112 | } catch (Exc eption e) { | |||||
| 113 | Asse rt.fail("t estGetFaci lityByStat ionNumberW ithEmptyIn put - Unex pected Exc eption - [ " + e.getM essage() + "]. "); | |||||
| 114 | } | |||||
| 115 | } | |||||
| 116 | ||||||
| 117 | @Test | |||||
| 118 | public void test GetFacilit yByStation NumberWith NullInput( ) { | |||||
| 119 | ||||||
| 120 | tr y { | |||||
| 121 | Facility facility = facility Service.ge tFacilityB yStationNu mber(null) ; | |||||
| 122 | } catch (Ill egalArgume ntExceptio n e) { | |||||
| 123 | Syst em.out.pri ntln("test GetFacilit yByStation NumberWith NullInput - Service Exception Message - [" + e.get Message() + "]. "); | |||||
| 124 | } catch (Exc eption e) { | |||||
| 125 | Asse rt.fail("t estGetFaci lityByStat ionNumberW ithNullInp ut - Unexp ected Exce ption - [" + e.getMe ssage() + "]. "); | |||||
| 126 | } | |||||
| 127 | } | |||||
| 128 | ||||||
| 129 | @Test( expected = EntityDoe sNotExistE xception.c lass) | |||||
| 130 | public void test GetFacilit yByStation NumberWith InvalidInp ut() throw s EntityDo esNotExist Exception { | |||||
| 131 | ||||||
| 132 | tr y { | |||||
| 133 | Facility facility = facility Service.ge tFacilityB yStationNu mber("Rand omFacility "); | |||||
| 134 | } catch (Ent ityDoesNot ExistExcep tion e) { | |||||
| 135 | Syst em.out.pri nt("testGe tFacilityB yStationNu mberWithIn validInput - Service Exception Message - [" + e.ge tMessage() + "]. "); | |||||
| 136 | if ( e.getCause () != null ) { | |||||
| 137 | System .out.print ln("Cause Exception Message - [" + e.get Cause().ge tMessage() + "]. "); | |||||
| 138 | } | |||||
| 139 | thro w e; | |||||
| 140 | } catch (Ex ception e) { | |||||
| 141 | Asse rt.fail("t estGetFaci lityByStat ionNumberW ithInvalid Input - Un expected E xception - [" + e.ge tMessage() + "]. "); | |||||
| 142 | } | |||||
| 143 | } | |||||
| 144 | ||||||
| 145 | @Test | |||||
| 146 | public void test GetLocatio nByLocatio nCode() { | |||||
| 147 | Lo cation loc ation = nu ll; | |||||
| 148 | tr y { | |||||
| 149 | location = facilit yService.g etLocation ByCode("IS W"); | |||||
| 150 | } catch (Ex ception e) { | |||||
| 151 | Asse rt.fail("t estGetLoca tionByLoca tionCode - Unexpecte d Exceptio n - [" + e .getMessag e() + "]. "); | |||||
| 152 | } | |||||
| 153 | As sert.asser tNotNull(l ocation); | |||||
| 154 | Sy stem.out.p rint("test GetLocatio nByLocatio nCode - Lo cation - [ " +locatio n.getLocat ionCode() + "]. "); | |||||
| 155 | As sert.asser tFalse(!"I SW".equals (location. getLocatio nCode())); | |||||
| 156 | As sert.asser tNotNull(l ocation.ge tFacility( )); | |||||
| 157 | Sy stem.out.p rintln("te stGetLocat ionByLocat ionCode - Facility - [" +locat ion.getFac ility().ge tFacilityS tation() + "]. "); | |||||
| 158 | } | |||||
| 159 | ||||||
| 160 | @Test | |||||
| 161 | public void test GetLocatio nByLocatio nCodeWithE mptyInput( ) { | |||||
| 162 | Lo cation loc ation = nu ll; | |||||
| 163 | tr y { | |||||
| 164 | location = facilit yService.g etLocation ByCode("") ; | |||||
| 165 | } catch (Ill egalArgume ntExceptio n e) { | |||||
| 166 | Syst em.out.pri ntln("test GetLocatio nByLocatio nCodeWithE mptyInput - Service Exception Message - [" + e.get Message() + "]. "); | |||||
| 167 | } catch (Exc eption e) { | |||||
| 168 | Asse rt.fail("t estGetLoca tionByLoca tionCodeWi thEmptyInp ut - Unexp ected Exce ption - [" + e.getMe ssage() + "]. "); | |||||
| 169 | } | |||||
| 170 | } | |||||
| 171 | ||||||
| 172 | @Test | |||||
| 173 | public void test GetLocatio nByLocatio nCodeWithN ullInput() { | |||||
| 174 | Lo cation loc ation = nu ll; | |||||
| 175 | tr y { | |||||
| 176 | location = facilit yService.g etLocation ByCode(nul l); | |||||
| 177 | } catch (Ill egalArgume ntExceptio n e) { | |||||
| 178 | Syst em.out.pri ntln("test GetLocatio nByLocatio nCodeWithN ullInput - Service E xception M essage - [ " + e.getM essage() + "]. "); | |||||
| 179 | } catch (Exc eption e) { | |||||
| 180 | Asse rt.fail("t estGetLoca tionByLoca tionCodeWi thNullInpu t - Unexpe cted Excep tion - [" + e.getMes sage() + " ]. "); | |||||
| 181 | } | |||||
| 182 | } | |||||
| 183 | ||||||
| 184 | @Test( expected = EntityDoe sNotExistE xception.c lass) | |||||
| 185 | public void test GetLocatio nByLocatio nCodeWithI nvalidInpu t() throws EntityDoe sNotExistE xception { | |||||
| 186 | Lo cation loc ation = nu ll; | |||||
| 187 | tr y { | |||||
| 188 | location = facilit yService.g etLocation ByCode("Ra ndomLC"); | |||||
| 189 | } catch (Ent ityDoesNot ExistExcep tion e) { | |||||
| 190 | Syst em.out.pri nt("testGe tLocationB yLocationC odeWithInv alidInput - Service Exception Message - [" + e.get Message() + "]. "); | |||||
| 191 | if ( e.getCause () != null ) { | |||||
| 192 | System .out.print ln("Cause Exception Message - [" + e.get Cause().ge tMessage() + "]. "); | |||||
| 193 | } | |||||
| 194 | thro w e; | |||||
| 195 | } catch (Exc eption e) { | |||||
| 196 | Asse rt.fail("t estGetLoca tionByLoca tionCodeWi thInvalidI nput - Une xpected Ex ception - [" + e.get Message() + "]. "); | |||||
| 197 | } | |||||
| 198 | } | |||||
| 199 | ||||||
| 200 | @Test | |||||
| 201 | public void getG etVHAUserF acilityWit hTestUser( ) { | |||||
| 202 | Fa cility fac ility = nu ll; | |||||
| 203 | tr y { | |||||
| 204 | facility = facilit yService.g etVHAUserF acility("w eblogic"); | |||||
| 205 | } catch (Exc eption e) { | |||||
| 206 | Asse rt.fail("g etGetVHAUs erFacility - Unexpec ted Except ion - [" + e.getMess age() + "] . "); | |||||
| 207 | } | |||||
| 208 | As sert.asser tNotNull(f acility); | |||||
| 209 | Sy stem.out.p rintln("ge tGetVHAUse rFacility - Facility - [" +fac ility.getF acilitySta tion() + " ]. "); | |||||
| 210 | As sert.asser tFalse(!"9 98".equals (facility. getFacilit yStation() )); | |||||
| 211 | } | |||||
| 212 | ||||||
| 213 | @Test | |||||
| 214 | public void getG etVHAUserF acility() { | |||||
| 215 | Fa cility fac ility = nu ll; | |||||
| 216 | tr y { | |||||
| 217 | facility = facilit yService.g etVHAUserF acility("v haISwabcd" ); | |||||
| 218 | } catch (Exc eption e) { | |||||
| 219 | Asse rt.fail("g etGetVHAUs erFacility - Unexpec ted Except ion - [" + e.getMess age() + "] . "); | |||||
| 220 | } | |||||
| 221 | As sert.asser tNotNull(f acility); | |||||
| 222 | Sy stem.out.p rintln("ge tGetVHAUse rFacility - Facility - [" +fac ility.getF acilitySta tion() + " ]. "); | |||||
| 223 | } | |||||
| 224 | ||||||
| 225 | @Test | |||||
| 226 | public void getG etVHAUserF acilityWit hEmptyInpu t() { | |||||
| 227 | Fa cility fac ility = nu ll; | |||||
| 228 | tr y { | |||||
| 229 | facility = facilit yService.g etVHAUserF acility("" ); | |||||
| 230 | } catch (Ill egalArgume ntExceptio n e) { | |||||
| 231 | Syst em.out.pri ntln("getG etVHAUserF acilityWit hEmptyInpu t - Servic e Exceptio n Message - [" + e.g etMessage( ) + "]. ") ; | |||||
| 232 | } catch (Exc eption e) { | |||||
| 233 | Asse rt.fail("g etGetVHAUs erFacility WithEmptyI nput - Une xpected Ex ception - [" + e.get Message() + "]. "); | |||||
| 234 | } | |||||
| 235 | } | |||||
| 236 | ||||||
| 237 | @Test | |||||
| 238 | public void getG etVHAUserF acilityWit hNullInput () { | |||||
| 239 | Fa cility fac ility = nu ll; | |||||
| 240 | tr y { | |||||
| 241 | facility = facilit yService.g etVHAUserF acility(nu ll); | |||||
| 242 | } catch (Ill egalArgume ntExceptio n e) { | |||||
| 243 | Syst em.out.pri ntln("getG etVHAUserF acilityWit hNullInput - Service Exception Message - [" + e.ge tMessage() + "]. "); | |||||
| 244 | } catch (Exc eption e) { | |||||
| 245 | Asse rt.fail("g etGetVHAUs erFacility WithNullIn put - Unex pected Exc eption - [ " + e.getM essage() + "]. "); | |||||
| 246 | } | |||||
| 247 | } | |||||
| 248 | ||||||
| 249 | @Test( expected = EntityDoe sNotExistE xception.c lass) | |||||
| 250 | public void getG etVHAUserF acilityWit hInvalidIn put() thro ws EntityD oesNotExis tException { | |||||
| 251 | Fa cility fac ility = nu ll; | |||||
| 252 | tr y { | |||||
| 253 | facility = facilit yService.g etVHAUserF acility("R andomUID") ; | |||||
| 254 | } catch (Ent ityDoesNot ExistExcep tion e) { | |||||
| 255 | Syst em.out.pri nt("getGet VHAUserFac ilityWithI nvalidInpu t - Servic e Exceptio n Message - [" + e.g etMessage( ) + "]. ") ; | |||||
| 256 | if ( e.getCause () != null ) { | |||||
| 257 | System .out.print ln("Cause Exception Message - [" + e.get Cause().ge tMessage() + "]. "); | |||||
| 258 | } | |||||
| 259 | thro w e; | |||||
| 260 | } catch (Exc eption e) { | |||||
| 261 | Asse rt.fail("g etGetVHAUs erFacility WithInvali dInput - U nexpected Exception - [" + e.g etMessage( ) + "]. ") ; | |||||
| 262 | } | |||||
| 263 | } | |||||
| 264 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.