Produced by Araxis Merge on 12/8/2017 1:33:40 PM 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 | PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\test\java\gov\va\med\fee\integration | RerouteClaimsIntegrationTest.java | Fri Dec 8 17:51:36 2017 UTC |
| 2 | PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\test\java\gov\va\med\fee\integration | RerouteClaimsIntegrationTest.java | Fri Dec 8 18:30:11 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 570 |
| Changed | 2 | 4 |
| 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.med.f ee.integra tion; | |
| 2 | ||
| 3 | //import s tatic org. hamcrest.M atchers.is ; | |
| 4 | import sta tic org.ju nit.Assert .assertFal se; | |
| 5 | import sta tic org.ju nit.Assert .assertTru e; | |
| 6 | ||
| 7 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.post; | |
| 8 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.put; | |
| 9 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tHandlers. print; | |
| 10 | ||
| 11 | ||
| 12 | import jav a.util.Arr ayList; | |
| 13 | import jav a.util.Lis t; | |
| 14 | ||
| 15 | import org .apache.lo gging.log4 j.LogManag er; | |
| 16 | import org .apache.lo gging.log4 j.Logger; | |
| 17 | import org .junit.Bef ore; | |
| 18 | import org .junit.Tes t; | |
| 19 | import org .junit.run ner.RunWit h; | |
| 20 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 21 | import org .springfra mework.htt p.HttpStat us; | |
| 22 | import org .springfra mework.htt p.MediaTyp e; | |
| 23 | import org .springfra mework.moc k.web.Mock HttpServle tResponse; | |
| 24 | import org .springfra mework.tes t.context. ContextCon figuration ; | |
| 25 | import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ; | |
| 26 | import org .springfra mework.tes t.context. web.WebApp Configurat ion; | |
| 27 | import org .springfra mework.tes t.web.serv let.MockMv c; | |
| 28 | import org .springfra mework.tes t.web.serv let.Result Actions; | |
| 29 | import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders; | |
| 30 | import org .springfra mework.web .context.W ebApplicat ionContext ; | |
| 31 | ||
| 32 | import com .fasterxml .jackson.c ore.JsonPr ocessingEx ception; | |
| 33 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
| 34 | import com .fasterxml .jackson.d atabind.Ob jectWriter ; | |
| 35 | import com .fasterxml .jackson.d atabind.Se rializatio nFeature; | |
| 36 | ||
| 37 | import gov .va.med.fe e.configur ation.AppC onfig; | |
| 38 | import gov .va.med.fe e.configur ation.hibe rnate.Pers istenceCon fig; | |
| 39 | import gov .va.med.fe e.configur ation.spri ng.SpringM vcConfig; | |
| 40 | import gov .va.med.fe e.model.re quest.Rero uteClaimRe quest; | |
| 41 | import gov .va.med.fe e.model.re sponse.Rer outeClaimI nfo; | |
| 42 | ||
| 43 | ||
| 44 | @WebAppCon figuration | |
| 45 | @RunWith(S pringJUnit 4ClassRunn er.class) | |
| 46 | @ContextCo nfiguratio n(classes = {AppConf ig.class, Persistenc eConfig.cl ass, Sprin gMvcConfig .class}) | |
| 47 | public cla ss Reroute ClaimsInte grationTes t { | |
| 48 | pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(Rero uteClaimsI ntegration Test.class ); | |
| 49 | ||
| 50 | pr ivate Mock Mvc mockMv c; | |
| 51 | @A utowired | |
| 52 | pr ivate WebA pplication Context wa c; | |
| 53 | @A utowired | |
| 54 | Mo ckHttpServ letRespons e response ; | |
| 55 | ||
| 56 | pr ivate fina l String D EFAULT_SEL ECT_VALUE = "-select -"; | |
| 57 | ||
| 58 | @B efore | |
| 59 | pu blic void setup() { | |
| 60 | mock Mvc = Mock MvcBuilder s.webAppCo ntextSetup (this.wac) .build(); | |
| 61 | } | |
| 62 | ||
| 63 | @T est | |
| 64 | pu blic void test_getRe route_erro r() { | |
| 65 | try { | |
| 66 | List<L ong> claim sToReroute = new Arr ayList<>() ; | |
| 67 | Result Actions s = mockMvc. perform(po st("/api/v 1/rerouteC laims/").c ontentType (MediaType .APPLICATI ON_JSON) | |
| 68 | .content(g etRequestJ son(claims ToReroute) )).andDo(p rint()); | |
| 69 | ||
| 70 | logger .info("tes t_getRerou te_error:" + s.andRe turn().get Response() .getStatus ()); | |
| 71 | assert True(HttpS tatus.BAD_ REQUEST.va lue() == s .andReturn ().getResp onse().get Status()); | |
| 72 | ||
| 73 | } ca tch (Excep tion e) { | |
| 74 | logger .error("te st_getRero utes -- ") ; | |
| 75 | e.prin tStackTrac e(); | |
| 76 | } | |
| 77 | } | |
| 78 | ||
| 79 | @T est | |
| 80 | pu blic void test_getRe routes() { | |
| 81 | try { | |
| 82 | List<L ong> claim sToReroute = new Arr ayList<>() ; | |
| 83 | claims ToReroute. add(527L); //isPrint ed | |
| 84 | claims ToReroute. add(539L); //can be rerouted | |
| 85 | /*clai msToRerout e.add(535L ); | |
| 86 | claims ToReroute. add(536L); | |
| 87 | claims ToReroute. add(537L); | |
| 88 | claims ToReroute. add(538L); | |
| 89 | claims ToReroute. add(539L); | |
| 90 | claims ToReroute. add(540L); | |
| 91 | claims ToReroute. add(101L); */ | |
| 92 | ||
| 93 | Result Actions s = mockMvc. perform(po st("/api/v 1/rerouteC laims/").c ontentType (MediaType .APPLICATI ON_JSON) | |
| 94 | .content(g etRequestJ son(claims ToReroute) )).andDo(p rint()); | |
| 95 | ||
| 96 | if (s. andReturn( ).getRespo nse().getS tatus() != HttpStatu s.OK.value ()) { | |
| 97 | logger.i nfo("test_ getReroute s:" + s.an dReturn(). getRespons e().getSta tus()); | |
| 98 | assertFa lse(HttpSt atus.BAD_R EQUEST.val ue() != s. andReturn( ).getRespo nse().getS tatus()); | |
| 99 | } else { | |
| 100 | logger.i nfo("test_ getReroute s:" + s.an dReturn(). getRespons e().getSta tus()); | |
| 101 | assertFa lse(HttpSt atus.OK.va lue() != s .andReturn ().getResp onse().get Status()); | |
| 102 | } | |
| 103 | } ca tch (Excep tion e) { | |
| 104 | logger .error("te st_getRero utes -- ") ; | |
| 105 | e.prin tStackTrac e(); | |
| 106 | } | |
| 107 | } | |
| 108 | ||
| 109 | @T est | |
| 110 | pu blic void test_getNo Reroutes() { | |
| 111 | try { | |
| 112 | List<L ong> claim sToReroute = new Arr ayList<>() ; | |
| 113 | claims ToReroute. add(2000L) ; | |
| 114 | ||
| 115 | Result Actions s = mockMvc. perform(po st("/api/v 1/rerouteC laims/").c ontentType (MediaType .APPLICATI ON_JSON) | |
| 116 | .content(g etRequestJ son(claims ToReroute) )).andDo(p rint()); | |
| 117 | ||
| 118 | //resp onse body is {"nonRo uted":"The following claim can not be rer outed beca use it is completed, partially reconcile d, rejecte d, or not FPPS: 2000 "} | |
| 119 | ||
| 120 | if (s. andReturn( ).getRespo nse().getS tatus() != HttpStatu s.OK.value ()) { | |
| 121 | logger.i nfo("test_ getReroute s:" + s.an dReturn(). getRespons e().getSta tus()); | |
| 122 | assertFa lse(HttpSt atus.BAD_R EQUEST.val ue() != s. andReturn( ).getRespo nse().getS tatus()); | |
| 123 | } else { | |
| 124 | logger.i nfo("test_ getReroute s:" + s.an dReturn(). getRespons e().getSta tus()); | |
| 125 | assertFa lse(HttpSt atus.OK.va lue() != s .andReturn ().getResp onse().get Status()); | |
| 126 | } | |
| 127 | } ca tch (Excep tion e) { | |
| 128 | logger .error("te st_getRero utes -- ") ; | |
| 129 | e.prin tStackTrac e(); | |
| 130 | } | |
| 131 | } | |
| 132 | ||
| 133 | @T est | |
| 134 | pu blic void testGetFac ilities_de fault() th rows Excep tion { | |
| 135 | ||
| 136 | try { | |
| 137 | String selectedV isnId = DE FAULT_SELE CT_VALUE; | |
| 138 | Rerout eClaimRequ est reques t= new Rer outeClaimR equest(); | |
| 139 | reques t.setSelec tedVisn(se lectedVisn Id); | |
| 140 | ||
| 141 | Result Actions s = mockMvc. perform(po st("/api/v 1/rerouteC laims/faci lities/"). contentTyp e(MediaTyp e.APPLICAT ION_JSON) | |
| 142 | .content(g etRequestJ son(reques t))).andDo (print()); | |
| 143 | ||
| 144 | if (s. andReturn( ).getRespo nse().getS tatus() != HttpStatu s.OK.value ()) { | |
| 145 | logger.i nfo("testG etFaciliti es_default :" + s.and Return().g etResponse ().getStat us()); | |
| 146 | assertFa lse(HttpSt atus.BAD_R EQUEST.val ue() != s. andReturn( ).getRespo nse().getS tatus()); | |
| 147 | } else { | |
| 148 | logger.i nfo("testG etFaciliti es_default :" + s.and Return().g etResponse ().getStat us()); | |
| 149 | assertFa lse(HttpSt atus.OK.va lue() != s .andReturn ().getResp onse().get Status()); | |
| 150 | } | |
| 151 | } ca tch (Excep tion e) { | |
| 152 | logger .error("te stGetFacil ities_defa ult -- "); | |
| 153 | e.prin tStackTrac e(); | |
| 154 | } | |
| 155 | ||
| 156 | } | |
| 157 | ||
| 158 | @T est | |
| 159 | pu blic void testGetFac ilities() throws Exc eption { | |
| 160 | ||
| 161 | try { | |
| 162 | String selectedV isnId = "1 6"; | |
| 163 | ||
| 164 | Rerout eClaimRequ est reques t= new Rer outeClaimR equest(); | |
| 165 | reques t.setSelec tedVisn(se lectedVisn Id); | |
| 166 | ||
| 167 | Result Actions s = mockMvc. perform(po st("/api/v 1/rerouteC laims/faci lities/"). contentTyp e(MediaTyp e.APPLICAT ION_JSON) | |
| 168 | .content(g etRequestJ son(reques t))).andDo (print()); | |
| 169 | ||
| 170 | if (s. andReturn( ).getRespo nse().getS tatus() != HttpStatu s.OK.value ()) { | |
| 171 | logger.i nfo("testG etFaciliti es:" + s.a ndReturn() .getRespon se().getSt atus()); | |
| 172 | assertFa lse(HttpSt atus.BAD_R EQUEST.val ue() != s. andReturn( ).getRespo nse().getS tatus()); | |
| 173 | } else { | |
| 174 | logger.i nfo("testG etFaciliti es:" + s.a ndReturn() .getRespon se().getSt atus()); | |
| 175 | assertFa lse(HttpSt atus.OK.va lue() != s .andReturn ().getResp onse().get Status()); | |
| 176 | } | |
| 177 | } ca tch (Excep tion e) { | |
| 178 | logger .error("te stGetFacil ities -- " ); | |
| 179 | e.prin tStackTrac e(); | |
| 180 | } | |
| 181 | ||
| 182 | } | |
| 183 | ||
| 184 | /* @Test | |
| 185 | pu blic void test_proce ssReroutes () { | |
| 186 | try { | |
| 187 | String cur rent_user_ name = " DN S MTESTER"; | |
| 188 | String selectedV isnId = "1 6"; | |
| 189 | String selectedF acilityId = "564"; | |
| 190 | String selectedR eason = "2 "; | |
| 191 | ||
| 192 | List<R erouteClai mInfo> cla ims_to_be_ rerouted = new Array List<>(); | |
| 193 | ||
| 194 | Rerout eClaimInfo info = ne w RerouteC laimInfo(5 35, "Emma Benny", "R OMETTY"); | |
| 195 | claims _to_be_rer outed.add( info); | |
| 196 | info = new Rerou teClaimInf o(536, "Ol ivia Britt any", "JAC OBS"); | |
| 197 | claims _to_be_rer outed.add( info); | |
| 198 | info = new Rerou teClaimInf o(537, "Av a George", "NOYI"); | |
| 199 | claims _to_be_rer outed.add( info); | |
| 200 | info = new Rerou teClaimInf o(538, "So phia Henry ", "ALBUS" ); | |
| 201 | claims _to_be_rer outed.add( info); | |
| 202 | info = new Rerou teClaimInf o(539, "Ch arlotte Hu go", "DRAC O"); | |
| 203 | claims _to_be_rer outed.add( info); | |
| 204 | info = new Rerou teClaimInf o(540, "Ha rper James ", "ARTHUR "); | |
| 205 | claims _to_be_rer outed.add( info); | |
| 206 | ||
| 207 | Rerout eClaimRequ est reques t= new Rer outeClaimR equest(); | |
| 208 | reques t.setClaim s_to_be_re routed(cla ims_to_be_ rerouted); | |
| 209 | reques t.setSelec tedFacilit y(selected FacilityId ); | |
| 210 | reques t.setSelec tedVisn(se lectedVisn Id); | |
| 211 | reques t.setSelec tedReason( selectedRe ason); | |
| 212 | reques t.setCurre nt_user_na me(current _user_name ); | |
| 213 | reques t.setComme nt("YOUR C OMMENT FOR REROUTE I S HERE"); | |
| 214 | ||
| 215 | Result Actions s = mockMvc. perform(pu t("/api/v1 /rerouteCl aims/rerou tes/").con tentType(M ediaType.A PPLICATION _JSON) | |
| 216 | .content(g etRequestJ son(reques t))).andDo (print()); | |
| 217 | ||
| 218 | if (s. andReturn( ).getRespo nse().getS tatus() != HttpStatu s.OK.value ()) { | |
| 219 | logger.i nfo("test_ processRer outes:" + s.andRetur n().getRes ponse().ge tStatus()) ; | |
| 220 | assertFa lse(HttpSt atus.BAD_R EQUEST.val ue() != s. andReturn( ).getRespo nse().getS tatus()); | |
| 221 | } else { | |
| 222 | logger.i nfo("test_ processRer outes:" + s.andRetur n().getRes ponse().ge tStatus()) ; | |
| 223 | assertFa lse(HttpSt atus.OK.va lue() != s .andReturn ().getResp onse().get Status()); | |
| 224 | } | |
| 225 | } ca tch (Excep tion e) { | |
| 226 | logger .error("te st_process Reroutes - - "); | |
| 227 | e.prin tStackTrac e(); | |
| 228 | } | |
| 229 | }* / | |
| 230 | ||
| 231 | @T est | |
| 232 | pu blic void test_proce ssReroutes _error() { | |
| 233 | try { | |
| 234 | String cur rent_user_ name = " DN S MTESTER"; | |
| 235 | String selectedV isnId = "2 3"; | |
| 236 | String selectedF acilityId = "564"; | |
| 237 | //Stri ng selecte dReason = "1"; | |
| 238 | List<R erouteClai mInfo> cla ims_to_be_ rerouted = new Array List<>(); | |
| 239 | ||
| 240 | Rerout eClaimInfo info = ne w RerouteC laimInfo(2 001, "Benj amin Lewis ", "CREW") ; | |
| 241 | claims _to_be_rer outed.add( info); | |
| 242 | info = new Rerou teClaimInf o(535, "Em ma Benny", "ROMETTY" ); | |
| 243 | claims _to_be_rer outed.add( info); | |
| 244 | ||
| 245 | Rerout eClaimRequ est reques t= new Rer outeClaimR equest(); | |
| 246 | reques t.setClaim s_to_be_re routed(cla ims_to_be_ rerouted); | |
| 247 | reques t.setSelec tedFacilit y(selected FacilityId ); | |
| 248 | reques t.setSelec tedVisn(se lectedVisn Id); | |
| 249 | //requ est.setSel ectedReaso n(selected Reason); | |
| 250 | reques t.setCurre nt_user_na me(current _user_name ); | |
| 251 | ||
| 252 | Result Actions s = mockMvc. perform(pu t("/api/v1 /rerouteCl aims/rerou tes/").con tentType(M ediaType.A PPLICATION _JSON) | |
| 253 | .content(g etRequestJ son(reques t))).andDo (print()); | |
| 254 | ||
| 255 | if (s. andReturn( ).getRespo nse().getS tatus() != HttpStatu s.OK.value ()) { | |
| 256 | logger.i nfo("test_ processRer outes_erro r:" + s.an dReturn(). getRespons e().getSta tus()); | |
| 257 | assertFa lse(HttpSt atus.BAD_R EQUEST.val ue() != s. andReturn( ).getRespo nse().getS tatus()); | |
| 258 | } else { | |
| 259 | logger.i nfo("test_ processRer outes_erro r:" + s.an dReturn(). getRespons e().getSta tus()); | |
| 260 | assertFa lse(HttpSt atus.OK.va lue() != s .andReturn ().getResp onse().get Status()); | |
| 261 | } | |
| 262 | } ca tch (Excep tion e) { | |
| 263 | logger .error("te st_process Reroutes_e rror -- ") ; | |
| 264 | e.prin tStackTrac e(); | |
| 265 | } | |
| 266 | } | |
| 267 | ||
| 268 | pr ivate Stri ng getRequ estJson(Ob ject reque st) { | |
| 269 | Stri ng request Json = nul l; | |
| 270 | try { | |
| 271 | Object Mapper map per = new ObjectMapp er(); | |
| 272 | mapper.con figure(Ser ialization Feature.WR AP_ROOT_VA LUE, false ); | |
| 273 | ObjectWrit er ow = ma pper.write r().withDe faultPrett yPrinter() ; | |
| 274 | reques tJson = ow .writeValu eAsString( request); | |
| 275 | System .out.print ln("reques tJson - " + requestJ son); | |
| 276 | ||
| 277 | } ca tch (JsonP rocessingE xception e ) { | |
| 278 | logger .error("ge tRequestJs on JsonPro cessingExc eption -- "); | |
| 279 | e.prin tStackTrac e(); | |
| 280 | ||
| 281 | } | |
| 282 | ||
| 283 | retu rn request Json; | |
| 284 | } | |
| 285 | ||
| 286 | ||
| 287 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.