Produced by Araxis Merge on 4/27/2018 2:59:15 PM Central 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 | v2.0_Sprint_15_Build_5.zip\v2.0_Sprint_15_Build_5\Unredacted\ARS_Backend\ars_app\src\test\java\gov\va\med\ars\integration | UserAdministrationRestIntegrationTest.java | Tue Apr 24 14:49:58 2018 UTC |
| 2 | v2.0_Sprint_15_Build_5..zip\v2.0_Sprint_15_Build_5\Unredacted\ARS_Backend\ars_app\src\test\java\gov\va\med\ars\integration | UserAdministrationRestIntegrationTest.java | Thu Apr 26 16:41:22 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 340 |
| 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.med.a rs.integra tion; | |
| 2 | ||
| 3 | import sta tic org.ha mcrest.Mat chers.is; | |
| 4 | import sta tic org.ju nit.Assert .assertFal se; | |
| 5 | import sta tic org.ju nit.Assert .assertTru e; | |
| 6 | import sta tic org.mo ckito.Matc hers.any; | |
| 7 | import sta tic org.mo ckito.Mock ito.times; | |
| 8 | import sta tic org.mo ckito.Mock ito.verify ; | |
| 9 | import sta tic org.mo ckito.Mock ito.verify NoMoreInte ractions; | |
| 10 | import sta tic org.mo ckito.Mock ito.when; | |
| 11 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.get; | |
| 12 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.post; | |
| 13 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tHandlers. print; | |
| 14 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. content; | |
| 15 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. jsonPath; | |
| 16 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status; | |
| 17 | ||
| 18 | import jav a.util.Arr ayList; | |
| 19 | import jav a.util.Lis t; | |
| 20 | ||
| 21 | import org .apache.lo gging.log4 j.LogManag er; | |
| 22 | import org .apache.lo gging.log4 j.Logger; | |
| 23 | import org .junit.Bef ore; | |
| 24 | import org .junit.Tes t; | |
| 25 | import org .junit.run ner.RunWit h; | |
| 26 | import org .mockito.A rgumentCap tor; | |
| 27 | import org .mockito.M atchers; | |
| 28 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 29 | import org .springfra mework.htt p.HttpStat us; | |
| 30 | import org .springfra mework.htt p.MediaTyp e; | |
| 31 | import org .springfra mework.tes t.context. ContextCon figuration ; | |
| 32 | import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ; | |
| 33 | import org .springfra mework.tes t.context. web.WebApp Configurat ion; | |
| 34 | import org .springfra mework.tes t.web.serv let.MockMv c; | |
| 35 | import org .springfra mework.tes t.web.serv let.Result Actions; | |
| 36 | import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders; | |
| 37 | import org .springfra mework.web .context.W ebApplicat ionContext ; | |
| 38 | ||
| 39 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
| 40 | import com .fasterxml .jackson.d atabind.Ob jectWriter ; | |
| 41 | import com .fasterxml .jackson.d atabind.Se rializatio nFeature; | |
| 42 | ||
| 43 | import gov .va.med.ar s.configur ation.AppC onfig; | |
| 44 | import gov .va.med.ar s.configur ation.spri ng.SpringM vcConfig; | |
| 45 | import gov .va.med.ar s.model.re quest.User SearchRequ est; | |
| 46 | import gov .va.med.ar s.model.re sponse.Gen ericRespon se; | |
| 47 | import gov .va.med.ar s.model.re sponse.Use rDetailsRe sponse; | |
| 48 | ||
| 49 | @WebAppCon figuration | |
| 50 | @RunWith(S pringJUnit 4ClassRunn er.class) | |
| 51 | @ContextCo nfiguratio n(classes = { AppCon fig.class, SpringMvc Config.cla ss }) | |
| 52 | public cla ss UserAdm inistratio nRestInteg rationTest { | |
| 53 | private st atic final Logger lo gger = Log Manager.ge tLogger(Us erAdminist rationRest Integratio nTest.clas s); | |
| 54 | ||
| 55 | @A utowired | |
| 56 | pr ivate WebA pplication Context wa c; | |
| 57 | pr ivate Mock Mvc mockMv c; | |
| 58 | ||
| 59 | @B efore | |
| 60 | pu blic void setup() { | |
| 61 | this .mockMvc = MockMvcBu ilders.web AppContext Setup(this .wac).buil d(); | |
| 62 | } | |
| 63 | @T est | |
| 64 | pu blic void testsearch AllUsers_f ailure() t hrows Exce ption { | |
| 65 | User SearchRequ est userSe archReques t = new Us erSearchRe quest(); | |
| 66 | user SearchRequ est.setAdm in(""); | |
| 67 | user SearchRequ est.setCre atedBy("") ; | |
| 68 | user SearchRequ est.setDes cending(fa lse); | |
| 69 | user SearchRequ est.setDom ain(""); | |
| 70 | user SearchRequ est.setEdi t(""); | |
| 71 | user SearchRequ est.setEma il(""); | |
| 72 | user SearchRequ est.setExp ort(""); | |
| 73 | user SearchRequ est.setFir stName("") ; | |
| 74 | user SearchRequ est.setLas tName(""); | |
| 75 | user SearchRequ est.setPag eNumber(1) ; | |
| 76 | user SearchRequ est.setPag eSize(10); | |
| 77 | user SearchRequ est.setPho ne(""); | |
| 78 | user SearchRequ est.setSor tColumn("" ); | |
| 79 | user SearchRequ est.setSta tus(""); | |
| 80 | user SearchRequ est.setUse rName(""); | |
| 81 | user SearchRequ est.setExp ort(""); | |
| 82 | user SearchRequ est.setEdi t(""); | |
| 83 | user SearchRequ est.setAdm in(""); | |
| 84 | ||
| 85 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
| 86 | mapp er.configu re(Seriali zationFeat ure.WRAP_R OOT_VALUE, false); | |
| 87 | Obje ctWriter o w = mapper .writer(). withDefaul tPrettyPri nter(); | |
| 88 | Stri ng request Json = ow. writeValue AsString(u serSearchR equest); | |
| 89 | ||
| 90 | Resu ltActions result = m ockMvc.per form(post( "/api/v1/u serSearch" ).contentT ype(MediaT ype.APPLIC ATION_JSON ).content( requestJso n)) | |
| 91 | .andDo(p rint()) | |
| 92 | .andExpe ct(status( ).is2xxSuc cessful()) | |
| 93 | .andExpe ct(content ().content Type("appl ication/js on;charset =UTF-8")); | |
| 94 | ||
| 95 | logg er.info("t estsearchA llUsers_su ccess:" + result.and Return().g etResponse ().getStat us()); | |
| 96 | asse rtFalse(Ht tpStatus.S ERVICE_UNA VAILABLE.v alue() == result.and Return().g etResponse ().getStat us()); | |
| 97 | ||
| 98 | } | |
| 99 | ||
| 100 | @T est | |
| 101 | pu blic void testEditUs er_failure () throws Exception { | |
| 102 | User SearchRequ est userSe archReques t = new Us erSearchRe quest(); | |
| 103 | user SearchRequ est.setAdm in(""); | |
| 104 | user SearchRequ est.setCre atedBy("") ; | |
| 105 | user SearchRequ est.setDes cending(fa lse); | |
| 106 | user SearchRequ est.setDom ain(""); | |
| 107 | user SearchRequ est.setEdi t(""); | |
| 108 | user SearchRequ est.setEma il(""); | |
| 109 | user SearchRequ est.setExp ort(""); | |
| 110 | user SearchRequ est.setFir stName("") ; | |
| 111 | user SearchRequ est.setLas tName(""); | |
| 112 | user SearchRequ est.setPag eNumber(1) ; | |
| 113 | user SearchRequ est.setPag eSize(10); | |
| 114 | user SearchRequ est.setPho ne(""); | |
| 115 | user SearchRequ est.setSor tColumn("" ); | |
| 116 | user SearchRequ est.setSta tus(""); | |
| 117 | user SearchRequ est.setUse rName(""); | |
| 118 | user SearchRequ est.setExp ort(""); | |
| 119 | user SearchRequ est.setEdi t(""); | |
| 120 | user SearchRequ est.setAdm in(""); | |
| 121 | ||
| 122 | ||
| 123 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
| 124 | mapp er.configu re(Seriali zationFeat ure.WRAP_R OOT_VALUE, false); | |
| 125 | Obje ctWriter o w = mapper .writer(). withDefaul tPrettyPri nter(); | |
| 126 | Stri ng request Json = ow. writeValue AsString(u serSearchR equest); | |
| 127 | Resu ltActions result = m ockMvc | |
| 128 | .perform (post("/ap i/v1/editU ser").cont entType(Me diaType.AP PLICATION_ JSON).cont ent(reques tJson)) | |
| 129 | .andDo(p rint()).an dExpect(st atus().is5 xxServerEr ror()); | |
| 130 | ||
| 131 | logg er.info("t estEditUse rSuccess:" + result. andReturn( ).getRespo nse().getS tatus()); | |
| 132 | asse rtTrue(Htt pStatus.IN TERNAL_SER VER_ERROR. value() == result.an dReturn(). getRespons e().getSta tus()); | |
| 133 | ||
| 134 | } | |
| 135 | ||
| 136 | @T est | |
| 137 | pu blic void testgetUse rById_fail ure() thro ws Excepti on { | |
| 138 | String use rId = " P I
|
|
| 139 | logg er.info("i ntegration testing") ; | |
| 140 | ||
| 141 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
| 142 | mapp er.configu re(Seriali zationFeat ure.WRAP_R OOT_VALUE, false); | |
| 143 | Obje ctWriter o w = mapper .writer(). withDefaul tPrettyPri nter(); | |
| 144 | Stri ng request Json = ow. writeValue AsString(u serId); | |
| 145 | Resu ltActions result = m ockMvc.per form( | |
| 146 | get("/ap i/v1/userD etails/" + userId).c ontentType (MediaType .APPLICATI ON_JSON).c ontent(req uestJson)) | |
| 147 | .andDo(p rint()).an dExpect(st atus().is2 xxSuccessf ul()); | |
| 148 | ||
| 149 | logg er.info("t estsearchA llUsers_su ccess:" + result.and Return().g etResponse ().getStat us()); | |
| 150 | asse rtTrue(Htt pStatus.OK .value() = = result.a ndReturn() .getRespon se().getSt atus()); | |
| 151 | ||
| 152 | } | |
| 153 | ||
| 154 | @T est | |
| 155 | pu blic void testdelete User_failu re() throw s Exceptio n { | |
| 156 | Long userId = (long) 100 ; | |
| 157 | ||
| 158 | ||
| 159 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
| 160 | mapp er.configu re(Seriali zationFeat ure.WRAP_R OOT_VALUE, false); | |
| 161 | Obje ctWriter o w = mapper .writer(). withDefaul tPrettyPri nter(); | |
| 162 | Stri ng request Json = ow. writeValue AsString(u serId); | |
| 163 | Resu ltActions result = m ockMvc.per form( | |
| 164 | get("/ap i/v1/userD elete/" + userId).co ntentType( MediaType. APPLICATIO N_JSON).co ntent(requ estJson)) | |
| 165 | .andDo(p rint()).an dExpect(st atus().is5 xxServerEr ror()); | |
| 166 | ||
| 167 | logg er.info("t estdeleteU serSuccess :" + resul t.andRetur n().getRes ponse().ge tStatus()) ; | |
| 168 | asse rtFalse(Ht tpStatus.O K.value() == result. andReturn( ).getRespo nse().getS tatus()); | |
| 169 | } | |
| 170 | ||
| 171 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.