Produced by Araxis Merge on 12/8/2017 1:33:39 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\controller | UserSearchControllerTest.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\controller | UserSearchControllerTest.java | Fri Dec 8 18:30:07 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 6 | 196 |
| Changed | 5 | 12 |
| 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.control ler; | |
| 2 | ||
| 3 | import sta tic org.ha mcrest.Mat chers.is; | |
| 4 | import sta tic org.mo ckito.Mock ito.times; | |
| 5 | import sta tic org.mo ckito.Mock ito.verify ; | |
| 6 | import sta tic org.mo ckito.Mock ito.verify NoMoreInte ractions; | |
| 7 | import sta tic org.mo ckito.Mock ito.when; | |
| 8 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.post; | |
| 9 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tHandlers. print; | |
| 10 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. content; | |
| 11 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. jsonPath; | |
| 12 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status; | |
| 13 | ||
| 14 | import jav a.util.Arr ayList; | |
| 15 | import jav a.util.Lis t; | |
| 16 | ||
| 17 | import org .apache.lo gging.log4 j.LogManag er; | |
| 18 | import org .apache.lo gging.log4 j.Logger; | |
| 19 | import org .junit.Bef ore; | |
| 20 | import org .junit.Tes t; | |
| 21 | import org .junit.run ner.RunWit h; | |
| 22 | import org .mockito.I njectMocks ; | |
| 23 | import org .mockito.M ock; | |
| 24 | import org .mockito.M ockitoAnno tations; | |
| 25 | import org .mockito.r unners.Moc kitoJUnitR unner; | |
| 26 | import org .springfra mework.htt p.MediaTyp e; | |
| 27 | import org .springfra mework.tes t.web.serv let.MockMv c; | |
| 28 | import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders; | |
| 29 | ||
| 30 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
| 31 | import com .fasterxml .jackson.d atabind.Ob jectWriter ; | |
| 32 | import com .fasterxml .jackson.d atabind.Se rializatio nFeature; | |
| 33 | ||
| 34 | import gov .va.med.fe e.filter.C ORSFilter; | |
| 35 | import gov .va.med.fe e.model.re quest.User SearchRequ est; | |
| 36 | import gov .va.med.fe e.model.re sponse.Use rSearchPag e; | |
| 37 | import gov .va.med.fe e.model.re sponse.Use rSearchRes ponse; | |
| 38 | import gov .va.med.fe e.service. IUserSearc hService; | |
| 39 | ||
| 40 | @RunWith(M ockitoJUni tRunner.cl ass) | |
| 41 | public cla ss UserSea rchControl lerTest { | |
| 42 | pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(User SearchCont rollerTest .class); | |
| 43 | ||
| 44 | pr ivate Mock Mvc mockMv c; | |
| 45 | ||
| 46 | @I njectMocks | |
| 47 | pr ivate User SearchCont roller use rSearchCon troller; | |
| 48 | ||
| 49 | @M ock | |
| 50 | IU serSearchS ervice iUs erSearchSe rvice; | |
| 51 | ||
| 52 | @B efore | |
| 53 | pu blic void init() thr ows Except ion { | |
| 54 | logg er.debug(" init"); | |
| 55 | Mock itoAnnotat ions.initM ocks(this) ; | |
| 56 | mock Mvc = Mock MvcBuilder s.standalo neSetup(us erSearchCo ntroller). addFilter( new CORSFi lter()).bu ild(); | |
| 57 | } | |
| 58 | ||
| 59 | @T est | |
| 60 | pu blic void test_searc hUser() th rows Excep tion { | |
| 61 | User SearchRequ est userSe archReques t = new Us erSearchRe quest(); | |
| 62 | userSearch Request.se tUserName( " DN S ABC"); | |
| 63 | userSearch Request.se tEmail(" PII "); | |
| 64 | user SearchRequ est.setPho ne("V67898 72563"); | |
| 65 | user SearchRequ est.setFir stName("Al vin"); | |
| 66 | user SearchRequ est.setLas tName("Sto ne"); | |
| 67 | user SearchRequ est.setSta tionId("12 0"); | |
| 68 | ||
| 69 | User SearchPage userSearc hPage = ne w UserSear chPage(); | |
| 70 | ||
| 71 | List <UserSearc hResponse> usersfrom Search = n ew ArrayLi st<UserSea rchRespons e>(); | |
| 72 | User SearchResp onse userS earchRespo nse = new UserSearch Response() ; | |
| 73 | user SearchResp onse.setAc tive("Y"); | |
| 74 | userSearch Response.s etUserName (" DN S ABC"); | |
| 75 | user SearchResp onse.setFi rstName("A lvin"); | |
| 76 | user SearchResp onse.setLa stName("St one"); | |
| 77 | userSearch Response.s etEmail(" PII "); | |
| 78 | user SearchResp onse.setPh one("67899 85267"); | |
| 79 | user sfromSearc h.add(user SearchResp onse); | |
| 80 | ||
| 81 | user SearchPage .setUsersf romSearch( usersfromS earch); | |
| 82 | ||
| 83 | when (iUserSear chService. searchUser (userSearc hRequest)) .thenRetur n(userSear chPage); | |
| 84 | ||
| 85 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
| 86 | mapper.c onfigure(S erializati onFeature. WRAP_ROOT_ VALUE, fal se); | |
| 87 | ObjectWr iter ow = mapper.wri ter().with DefaultPre ttyPrinter (); | |
| 88 | Stri ng request Json = ow. writeValue AsString(u serSearchR equest); | |
| 89 | ||
| 90 | mock Mvc.perfor m(post("/a pi/v1/user /search"). contentTyp e(MediaTyp e.APPLICAT ION_JSON). content(re questJson) ).andDo(pr int()) | |
| 91 | .andEx pect(statu s().isOk() ) | |
| 92 | .andEx pect(conte nt().conte ntType(Med iaType.APP LICATION_J SON_UTF8_V ALUE)) | |
| 93 | .andEx pect(jsonP ath("$.use rsfromSear ch[0].firs tName", is ("Alvin")) ) | |
| 94 | .andEx pect(jsonP ath("$.use rsfromSear ch[0].last Name", is( "Stone"))) | |
| 95 | .andExpect (jsonPath( "$.usersfr omSearch[0 ].email", is(" PII "))) | |
| 96 | .andEx pect(jsonP ath("$.use rsfromSear ch[0].phon e", is("67 89985267") )) | |
| 97 | .andEx pect(jsonP ath("$.use rsfromSear ch[0].acti ve", is("Y "))) | |
| 98 | .andExpect (jsonPath( "$.usersfr omSearch[0 ].userName ", is(" DN S ABC"))); | |
| 99 | ||
| 100 | ||
| 101 | veri fy(iUserSe archServic e, times(1 )).searchU ser(userSe archReques t); | |
| 102 | veri fyNoMoreIn teractions (iUserSear chService) ; | |
| 103 | } | |
| 104 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.