Produced by Araxis Merge on 11/14/2017 6:57:21 AM Central 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 | cbs.zip\cbs\cbs\src\test\java\gov\va\cpss\service | CbsServiceTest.java | Thu Nov 9 14:19:48 2017 UTC |
| 2 | cbs.zip\cbs\cbs\src\test\java\gov\va\cpss\service | CbsServiceTest.java | Tue Nov 14 12:28:52 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 606 |
| 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 | package go v.va.cpss. service; | |
| 2 | ||
| 3 | import sta tic org.ju nit.Assert .assertEqu als; | |
| 4 | ||
| 5 | import jav a.util.Col lections; | |
| 6 | import jav a.util.Has hMap; | |
| 7 | import jav a.util.Lis t; | |
| 8 | import jav a.util.Map ; | |
| 9 | ||
| 10 | import org .junit.Tes t; | |
| 11 | import org .junit.run ner.RunWit h; | |
| 12 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 13 | import org .springfra mework.tes t.context. ContextCon figuration ; | |
| 14 | import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ; | |
| 15 | ||
| 16 | import gov .va.cpss.m odel.cbs.C BSSiteStmt ; | |
| 17 | import gov .va.cpss.m odel.cbs.C BSStmt; | |
| 18 | import gov .va.cpss.m odel.fps.P SPatient; | |
| 19 | ||
| 20 | /** | |
| 21 | * Integra tion Unit Tests to t est busine ss logic o f Generate CBS batch | |
| 22 | * process ing. | |
| 23 | * | |
| 24 | * @author DN S BROWNL | |
| 25 | */ | |
| 26 | @RunWith(S pringJUnit 4ClassRunn er.class) | |
| 27 | @ContextCo nfiguratio n(location s = { "/te st-context .xml", "/c pss-contex t.xml", "/ cpss-batch .xml" }) | |
| 28 | public cla ss CbsServ iceTest { | |
| 29 | ||
| 30 | pr ivate CbsS erviceTest Patients t estPatient s = new Cb sServiceTe stPatients (); | |
| 31 | ||
| 32 | @A utowired | |
| 33 | pr ivate CbsS ervice cbs Service; | |
| 34 | ||
| 35 | @T est | |
| 36 | pu blic final void test CalculateT otals() { | |
| 37 | ||
| 38 | Map< Long, List <PSPatient >> patient Map = new HashMap<>( ); | |
| 39 | pati entMap.put (1234L, te stPatients .getTestPa tientList( )); | |
| 40 | ||
| 41 | CBSS tmt statem ent = cbsS ervice.bui ldStatemen tForPatien tMap(1, pa tientMap.e ntrySet(). iterator() .next()); | |
| 42 | ||
| 43 | asse rtEquals(" 1001.00", statement. getAmountD ue().getDo ubleAsStri ng()); | |
| 44 | asse rtEquals(" 101.00", s tatement.g etPrevBala nce().getD oubleAsStr ing()); | |
| 45 | asse rtEquals(" 11.00", st atement.ge tTotalChar ges().getD oubleAsStr ing()); | |
| 46 | asse rtEquals(" 111.10", s tatement.g etTotalCre dits().get DoubleAsSt ring()); | |
| 47 | asse rtEquals(" 101.10", s tatement.g etNewBalan ce().getDo ubleAsStri ng()); | |
| 48 | } | |
| 49 | ||
| 50 | @T est | |
| 51 | pu blic final void test PrimarySit eFlags() { | |
| 52 | ||
| 53 | Map< Long, List <PSPatient >> patient Map = new HashMap<>( ); | |
| 54 | pati entMap.put (1234L, te stPatients .getTestPa tientList( )); | |
| 55 | ||
| 56 | CBSS tmt statem ent = cbsS ervice.bui ldStatemen tForPatien tMap(1, pa tientMap.e ntrySet(). iterator() .next()); | |
| 57 | ||
| 58 | List <CBSSiteSt mt> siteSt atementL = statement .getSiteSt mtL(); | |
| 59 | ||
| 60 | CBSS iteStmt pr imarySiteS tatement = null; | |
| 61 | CBSS iteStmt pr imaryAddre ssSiteStat ement = nu ll; | |
| 62 | ||
| 63 | int primarySit eStatement Counter = 0; | |
| 64 | int primaryAdd ressSiteSt atementCou nter = 0; | |
| 65 | for (CBSSiteSt mt siteSta tement : s iteStateme ntL) { | |
| 66 | if (si teStatemen t.getIsPri mary().isT rue()) { | |
| 67 | primaryS iteStateme nt = siteS tatement; | |
| 68 | primaryS iteStateme ntCounter+ +; | |
| 69 | } | |
| 70 | if (si teStatemen t.getIsPri maryAddres s().isTrue ()) { | |
| 71 | primaryA ddressSite Statement = siteStat ement; | |
| 72 | primaryA ddressSite StatementC ounter++; | |
| 73 | } | |
| 74 | } | |
| 75 | ||
| 76 | asse rtEquals(1 , primaryS iteStateme ntCounter) ; | |
| 77 | asse rtEquals(1 , primaryA ddressSite StatementC ounter); | |
| 78 | ||
| 79 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), p rimarySite Statement. getLastBil lPrepDate( )); | |
| 80 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), | |
| 81 | primaryA ddressSite Statement. getLastBil lPrepDate( )); | |
| 82 | } | |
| 83 | ||
| 84 | @T est | |
| 85 | pu blic final void test PrimarySit eFlagsReve rsedInput( ) { | |
| 86 | ||
| 87 | Map< Long, List <PSPatient >> patient Map = new HashMap<>( ); | |
| 88 | List <PSPatient > reversed List = tes tPatients. getTestPat ientList() ; | |
| 89 | Coll ections.re verse(reve rsedList); | |
| 90 | ||
| 91 | pati entMap.put (1234L, re versedList ); | |
| 92 | ||
| 93 | CBSS tmt statem ent = cbsS ervice.bui ldStatemen tForPatien tMap(1, pa tientMap.e ntrySet(). iterator() .next()); | |
| 94 | ||
| 95 | List <CBSSiteSt mt> siteSt atementL = statement .getSiteSt mtL(); | |
| 96 | ||
| 97 | CBSS iteStmt pr imarySiteS tatement = null; | |
| 98 | CBSS iteStmt pr imaryAddre ssSiteStat ement = nu ll; | |
| 99 | ||
| 100 | int primarySit eStatement Counter = 0; | |
| 101 | int primaryAdd ressSiteSt atementCou nter = 0; | |
| 102 | for (CBSSiteSt mt siteSta tement : s iteStateme ntL) { | |
| 103 | if (si teStatemen t.getIsPri mary().isT rue()) { | |
| 104 | primaryS iteStateme nt = siteS tatement; | |
| 105 | primaryS iteStateme ntCounter+ +; | |
| 106 | } | |
| 107 | if (si teStatemen t.getIsPri maryAddres s().isTrue ()) { | |
| 108 | primaryA ddressSite Statement = siteStat ement; | |
| 109 | primaryA ddressSite StatementC ounter++; | |
| 110 | } | |
| 111 | } | |
| 112 | ||
| 113 | asse rtEquals(1 , primaryS iteStateme ntCounter) ; | |
| 114 | asse rtEquals(1 , primaryA ddressSite StatementC ounter); | |
| 115 | ||
| 116 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), p rimarySite Statement. getLastBil lPrepDate( )); | |
| 117 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), | |
| 118 | primaryA ddressSite Statement. getLastBil lPrepDate( )); | |
| 119 | } | |
| 120 | ||
| 121 | @T est | |
| 122 | pu blic final void test PrimarySit eArFlagsIn put() { | |
| 123 | ||
| 124 | Map< Long, List <PSPatient >> patient Map = new HashMap<>( ); | |
| 125 | List <PSPatient > reversed List = tes tPatients. getArTestP atientList (); | |
| 126 | Coll ections.re verse(reve rsedList); | |
| 127 | ||
| 128 | pati entMap.put (1234L, re versedList ); | |
| 129 | ||
| 130 | CBSS tmt statem ent = cbsS ervice.bui ldStatemen tForPatien tMap(1, pa tientMap.e ntrySet(). iterator() .next()); | |
| 131 | ||
| 132 | List <CBSSiteSt mt> siteSt atementL = statement .getSiteSt mtL(); | |
| 133 | ||
| 134 | CBSS iteStmt pr imarySiteS tatement = null; | |
| 135 | CBSS iteStmt pr imaryAddre ssSiteStat ement = nu ll; | |
| 136 | ||
| 137 | int primarySit eStatement Counter = 0; | |
| 138 | int primaryAdd ressSiteSt atementCou nter = 0; | |
| 139 | for (CBSSiteSt mt siteSta tement : s iteStateme ntL) { | |
| 140 | if (si teStatemen t.getIsPri mary().isT rue()) { | |
| 141 | primaryS iteStateme nt = siteS tatement; | |
| 142 | primaryS iteStateme ntCounter+ +; | |
| 143 | } | |
| 144 | if (si teStatemen t.getIsPri maryAddres s().isTrue ()) { | |
| 145 | primaryA ddressSite Statement = siteStat ement; | |
| 146 | primaryA ddressSite StatementC ounter++; | |
| 147 | } | |
| 148 | } | |
| 149 | ||
| 150 | asse rtEquals(1 , primaryS iteStateme ntCounter) ; | |
| 151 | asse rtEquals(1 , primaryA ddressSite StatementC ounter); | |
| 152 | ||
| 153 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), p rimarySite Statement. getLastBil lPrepDate( )); | |
| 154 | asse rtEquals(t estPatient s.getPatie nt1().getL astBillPre pDate(), | |
| 155 | primaryA ddressSite Statement. getLastBil lPrepDate( )); | |
| 156 | } | |
| 157 | ||
| 158 | @T est | |
| 159 | pu blic final void test PrimarySit eMultipleA rFlagsInpu t() { | |
| 160 | ||
| 161 | Map< Long, List <PSPatient >> patient Map = new HashMap<>( ); | |
| 162 | List <PSPatient > reversed List = tes tPatients. getMultipl eArTestPat ientList() ; | |
| 163 | Coll ections.re verse(reve rsedList); | |
| 164 | ||
| 165 | pati entMap.put (1234L, re versedList ); | |
| 166 | ||
| 167 | CBSS tmt statem ent = cbsS ervice.bui ldStatemen tForPatien tMap(1, pa tientMap.e ntrySet(). iterator() .next()); | |
| 168 | ||
| 169 | List <CBSSiteSt mt> siteSt atementL = statement .getSiteSt mtL(); | |
| 170 | ||
| 171 | CBSS iteStmt pr imarySiteS tatement = null; | |
| 172 | CBSS iteStmt pr imaryAddre ssSiteStat ement = nu ll; | |
| 173 | ||
| 174 | int primarySit eStatement Counter = 0; | |
| 175 | int primaryAdd ressSiteSt atementCou nter = 0; | |
| 176 | for (CBSSiteSt mt siteSta tement : s iteStateme ntL) { | |
| 177 | if (si teStatemen t.getIsPri mary().isT rue()) { | |
| 178 | primaryS iteStateme nt = siteS tatement; | |
| 179 | primaryS iteStateme ntCounter+ +; | |
| 180 | } | |
| 181 | if (si teStatemen t.getIsPri maryAddres s().isTrue ()) { | |
| 182 | primaryA ddressSite Statement = siteStat ement; | |
| 183 | primaryA ddressSite StatementC ounter++; | |
| 184 | } | |
| 185 | } | |
| 186 | ||
| 187 | asse rtEquals(1 , primaryS iteStateme ntCounter) ; | |
| 188 | asse rtEquals(1 , primaryA ddressSite StatementC ounter); | |
| 189 | ||
| 190 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), p rimarySite Statement. getLastBil lPrepDate( )); | |
| 191 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), | |
| 192 | primaryA ddressSite Statement. getLastBil lPrepDate( )); | |
| 193 | } | |
| 194 | ||
| 195 | @T est | |
| 196 | pu blic final void test MergeWithE xistingSta tement() { | |
| 197 | ||
| 198 | Map< Long, List <PSPatient >> patient Map = new HashMap<>( ); | |
| 199 | pati entMap.put (1234L, te stPatients .getTestPa tientList( )); | |
| 200 | ||
| 201 | // N ewly Proce ssed State ment. | |
| 202 | CBSS tmt statem ent = cbsS ervice.bui ldStatemen tForPatien tMap(1, pa tientMap.e ntrySet(). iterator() .next()); | |
| 203 | ||
| 204 | List <CBSSiteSt mt> siteSt atementL = statement .getSiteSt mtL(); | |
| 205 | ||
| 206 | CBSS iteStmt pr imarySiteS tatement = null; | |
| 207 | CBSS iteStmt pr imaryAddre ssSiteStat ement = nu ll; | |
| 208 | ||
| 209 | int primarySit eStatement Counter = 0; | |
| 210 | int primaryAdd ressSiteSt atementCou nter = 0; | |
| 211 | for (CBSSiteSt mt siteSta tement : s iteStateme ntL) { | |
| 212 | if (si teStatemen t.getIsPri mary().isT rue()) { | |
| 213 | primaryS iteStateme nt = siteS tatement; | |
| 214 | primaryS iteStateme ntCounter+ +; | |
| 215 | } | |
| 216 | if (si teStatemen t.getIsPri maryAddres s().isTrue ()) { | |
| 217 | primaryA ddressSite Statement = siteStat ement; | |
| 218 | primaryA ddressSite StatementC ounter++; | |
| 219 | } | |
| 220 | } | |
| 221 | ||
| 222 | asse rtEquals(1 , primaryS iteStateme ntCounter) ; | |
| 223 | asse rtEquals(1 , primaryA ddressSite StatementC ounter); | |
| 224 | ||
| 225 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), p rimarySite Statement. getLastBil lPrepDate( )); | |
| 226 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), | |
| 227 | primaryA ddressSite Statement. getLastBil lPrepDate( )); | |
| 228 | ||
| 229 | // E xisting St atement | |
| 230 | pati entMap = n ew HashMap <>(); | |
| 231 | pati entMap.put (1234L, te stPatients .getTestPa tientList2 ()); | |
| 232 | ||
| 233 | CBSS tmt existi ngStatemen t = cbsSer vice.build StatementF orPatientM ap(1, | |
| 234 | patientM ap.entrySe t().iterat or().next( )); | |
| 235 | ||
| 236 | asse rtEquals(" 122.08", e xistingSta tement.get AmountDue( ).getDoubl eAsString( )); | |
| 237 | asse rtEquals(" 30.57", ex istingStat ement.getP revBalance ().getDoub leAsString ()); | |
| 238 | asse rtEquals(" 10.90", ex istingStat ement.getT otalCharge s().getDou bleAsStrin g()); | |
| 239 | asse rtEquals(" 12.90", ex istingStat ement.getT otalCredit s().getDou bleAsStrin g()); | |
| 240 | asse rtEquals(" 0.51", exi stingState ment.getNe wBalance() .getDouble AsString() ); | |
| 241 | ||
| 242 | List <CBSSiteSt mt> existi ngSiteStat ementL = e xistingSta tement.get SiteStmtL( ); | |
| 243 | ||
| 244 | CBSS iteStmt ex istingPrim arySiteSta tement = n ull; | |
| 245 | CBSS iteStmt ex istingPrim aryAddress SiteStatem ent = null ; | |
| 246 | ||
| 247 | int existingPr imarySiteS tatementCo unter = 0; | |
| 248 | int existingPr imaryAddre ssSiteStat ementCount er = 0; | |
| 249 | for (CBSSiteSt mt siteSta tement : e xistingSit eStatement L) { | |
| 250 | if (si teStatemen t.getIsPri mary().isT rue()) { | |
| 251 | existing PrimarySit eStatement = siteSta tement; | |
| 252 | existing PrimarySit eStatement Counter++; | |
| 253 | } | |
| 254 | if (si teStatemen t.getIsPri maryAddres s().isTrue ()) { | |
| 255 | existing PrimaryAdd ressSiteSt atement = siteStatem ent; | |
| 256 | existing PrimaryAdd ressSiteSt atementCou nter++; | |
| 257 | } | |
| 258 | } | |
| 259 | ||
| 260 | asse rtEquals(1 , existing PrimarySit eStatement Counter); | |
| 261 | asse rtEquals(1 , existing PrimaryAdd ressSiteSt atementCou nter); | |
| 262 | ||
| 263 | asse rtEquals(t estPatient s.getPatie nt6().getL astBillPre pDate(), | |
| 264 | existing PrimarySit eStatement .getLastBi llPrepDate ()); | |
| 265 | asse rtEquals(t estPatient s.getPatie nt5().getL astBillPre pDate(), | |
| 266 | existing PrimaryAdd ressSiteSt atement.ge tLastBillP repDate()) ; | |
| 267 | ||
| 268 | // N ow combine the two s tatements. | |
| 269 | cbsS ervice.com bineWithEx istingStat ement(stat ement, exi stingState ment); | |
| 270 | ||
| 271 | asse rtEquals(" 1123.08", statement. getAmountD ue().getDo ubleAsStri ng()); | |
| 272 | asse rtEquals(" 131.57", s tatement.g etPrevBala nce().getD oubleAsStr ing()); | |
| 273 | asse rtEquals(" 21.90", st atement.ge tTotalChar ges().getD oubleAsStr ing()); | |
| 274 | asse rtEquals(" 124.00", s tatement.g etTotalCre dits().get DoubleAsSt ring()); | |
| 275 | asse rtEquals(" 101.61", s tatement.g etNewBalan ce().getDo ubleAsStri ng()); | |
| 276 | ||
| 277 | List <CBSSiteSt mt> merged SiteStatem entL = sta tement.get SiteStmtL( ); | |
| 278 | ||
| 279 | CBSS iteStmt me rgedPrimar ySiteState ment = nul l; | |
| 280 | CBSS iteStmt me rgedPrimar yAddressSi teStatemen t = null; | |
| 281 | ||
| 282 | int mergedPrim arySiteSta tementCoun ter = 0; | |
| 283 | int mergedPrim aryAddress SiteStatem entCounter = 0; | |
| 284 | for (CBSSiteSt mt siteSta tement : m ergedSiteS tatementL) { | |
| 285 | if (si teStatemen t.getIsPri mary().isT rue()) { | |
| 286 | mergedPr imarySiteS tatement = siteState ment; | |
| 287 | mergedPr imarySiteS tatementCo unter++; | |
| 288 | } | |
| 289 | if (si teStatemen t.getIsPri maryAddres s().isTrue ()) { | |
| 290 | mergedPr imaryAddre ssSiteStat ement = si teStatemen t; | |
| 291 | mergedPr imaryAddre ssSiteStat ementCount er++; | |
| 292 | } | |
| 293 | } | |
| 294 | ||
| 295 | asse rtEquals(1 , mergedPr imarySiteS tatementCo unter); | |
| 296 | asse rtEquals(1 , mergedPr imaryAddre ssSiteStat ementCount er); | |
| 297 | ||
| 298 | asse rtEquals(t estPatient s.getPatie nt3().getL astBillPre pDate(), | |
| 299 | mergedPr imarySiteS tatement.g etLastBill PrepDate() ); | |
| 300 | asse rtEquals(t estPatient s.getPatie nt5().getL astBillPre pDate(), | |
| 301 | mergedPr imaryAddre ssSiteStat ement.getL astBillPre pDate()); | |
| 302 | } | |
| 303 | ||
| 304 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.