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