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\ewv\integration | EwvClaimControllerIntegrationTest.java | Wed Mar 27 19:21:16 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\ARS_Backend\ars_app\src\test\java\gov\va\med\ewv\integration | EwvClaimControllerIntegrationTest.java | Thu Mar 28 17:51:16 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 836 |
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.e wv.integra tion; | |
2 | ||
3 | import sta tic org.ju nit.Assert .assertFal se; | |
4 | import sta tic org.ju nit.Assert .assertTru e; | |
5 | ||
6 | import sta tic org.sp ringframew ork.test.w eb.servlet .request.M ockMvcRequ estBuilder s.get; | |
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 .result.Mo ckMvcResul tHandlers. print; | |
9 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. content; | |
10 | import sta tic org.sp ringframew ork.test.w eb.servlet .result.Mo ckMvcResul tMatchers. status; | |
11 | ||
12 | import jav a.math.Big Decimal; | |
13 | import jav a.util.Arr ayList; | |
14 | import jav a.util.Lis t; | |
15 | ||
16 | import org .springfra mework.web .multipart .Multipart File; | |
17 | import org .springfra mework.web .servlet.c onfig.anno tation.Ena bleWebMvc; | |
18 | ||
19 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
20 | import com .fasterxml .jackson.d atabind.Ob jectWriter ; | |
21 | import com .fasterxml .jackson.d atabind.Se rializatio nFeature; | |
22 | ||
23 | import org .springfra mework.htt p.MediaTyp e; | |
24 | import org .springfra mework.moc k.web.Mock MultipartF ile; | |
25 | ||
26 | import org .apache.lo gging.log4 j.LogManag er; | |
27 | import org .apache.lo gging.log4 j.Logger; | |
28 | import org .junit.Bef ore; | |
29 | import org .junit.Ign ore; | |
30 | import org .junit.Tes t; | |
31 | import org .junit.run ner.RunWit h; | |
32 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
33 | import org .springfra mework.htt p.HttpStat us; | |
34 | //import o rg.springf ramework.h ttp.MediaT ype; | |
35 | import org .springfra mework.tes t.context. ActiveProf iles; | |
36 | import org .springfra mework.tes t.context. ContextCon figuration ; | |
37 | import org .springfra mework.tes t.context. TestProper tySource; | |
38 | import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ; | |
39 | import org .springfra mework.tes t.context. web.WebApp Configurat ion; | |
40 | import org .springfra mework.tes t.web.serv let.MockMv c; | |
41 | import org .springfra mework.tes t.web.serv let.Result Actions; | |
42 | import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders; | |
43 | import org .springfra mework.web .context.W ebApplicat ionContext ; | |
44 | ||
45 | import gov .va.med.ar s.configur ation.AppC onfig; | |
46 | import gov .va.med.ar s.configur ation.spri ng.SpringM vcConfig; | |
47 | import gov .va.med.ew v.bean.Arc hiveFileRe quest; | |
48 | import gov .va.med.ew v.bean.Arc hivedPdfRe ference; | |
49 | import gov .va.med.ew v.bean.Fil eUploadReq uest; | |
50 | ||
51 | /** | |
52 | * These a re several JUNit Tes t Cases th at use Spr ing MockMv c Framewor k to test the follow ing | |
53 | * RESTFul Web Servi ces servic ed by the EwvClaimCo ntroller J ava class: | |
54 | * 1) /api /v1/ewvCla im/{pdiNum ber} | |
55 | * 2) /api /v1/pdfRef erence/get AllPdfRefe rences | |
56 | * 3) /api /v1/fileup load | |
57 | * 4) /api /v1/filear chive | |
58 | * | |
59 | * Use thi s class to test the code for t he above m entioned R ESTFul Web Services. You selec tively | |
60 | * run one or more o f the JUni t Test cas es by sele ctively co mmenting o ut the @Ig nore annot ation(s). | |
61 | * Testing the busin ess login code using this clas s eliminat es the nee d to run a full-blow n | |
62 | * Tomcat Web Server to test t he code. | |
63 | * | |
64 | * @author DN S PEREZF | |
65 | * | |
66 | */ | |
67 | @WebAppCon figuration | |
68 | @RunWith(S pringJUnit 4ClassRunn er.class) | |
69 | @ContextCo nfiguratio n(classes = { AppCon fig.class, SpringMvc Config.cla ss }) | |
70 | @TestPrope rtySource( properties = {"arsPr opFileLoca tion = ./s rc/test/re sources/de velopment. properties "}) | |
71 | public cla ss EwvClai mControlle rIntegrati onTest { | |
72 | pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(EwvC laimContro llerIntegr ationTest. class); | |
73 | ||
74 | @A utowired | |
75 | pr ivate WebA pplication Context wa c; | |
76 | pr ivate Mock Mvc mockMv c; | |
77 | ||
78 | @B efore | |
79 | pu blic void setup() { | |
80 | this .mockMvc = MockMvcBu ilders.web AppContext Setup(this .wac).buil d(); | |
81 | } | |
82 | ||
83 | /* * | |
84 | * Tests for getting a n EWV Dent al Claim f rom the EW V Database using Moc kMvc Frame work call to | |
85 | * the "/api /v1/ewvCla im/{pdiNum ber}" REST Ful Web Se rvice. | |
86 | * | |
87 | * @throws E xception - if some e rror occur s | |
88 | * / | |
89 | @T est | |
90 | @I gnore | |
91 | pu blic void getDetailD ental_succ ess() thro ws Excepti on { | |
92 | //De ntal - 200 6172030009 52 | |
93 | //IN ST - 20061 7203000959 | |
94 | //Pr of - 20061 7203000825 | |
95 | ||
96 | Resu ltActions s = mockMv c.perform( get("/api/ v1/ewvClai m/{pdiNumb er}", "200 6172030009 52")).andD o(print()) | |
97 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
98 | ||
99 | logg er.info("t estGetClai ms_Success :" + s.and Return().g etResponse ().getStat us()); | |
100 | asse rtFalse(Ht tpStatus.O K.value() != s.andRe turn().get Response() .getStatus ()); | |
101 | } | |
102 | ||
103 | /* * | |
104 | * Tests for getting a n EWV Inst itutional Claim from an EWV Da tabase usi ng Spring MockMvc Fr amework ca ll to | |
105 | * the "/api /v1/ewvCla im/{pdiNum ber}" REST Ful Web Se rvice. | |
106 | * | |
107 | * @throws E xception - if some e rror occur s | |
108 | * / | |
109 | @T est | |
110 | @I gnore | |
111 | pu blic void getiDetail Inst_succe ss() throw s Exceptio n { | |
112 | //IN ST 1000000 00001399 - test for drug line info | |
113 | Resu ltActions s = mockMv c.perform( get("/api/ v1/ewvClai m/{pdiNumb er}", "201 7229910016 91")).andD o(print()) | |
114 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
115 | ||
116 | logg er.info("t estGetClai ms_Success :" + s.and Return().g etResponse ().getStat us()); | |
117 | asse rtFalse(Ht tpStatus.O K.value() != s.andRe turn().get Response() .getStatus ()); | |
118 | } | |
119 | ||
120 | @T est | |
121 | @I gnore | |
122 | pu blic void getClaim_D me_success () throws Exception { | |
123 | //IN ST 1000000 00001399 - test for drug line info | |
124 | Resu ltActions s = mockMv c.perform( get("/api/ v1/ewvClai m/{pdiNumb er}", "200 6172030009 52")).andD o(print()) | |
125 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
126 | ||
127 | logg er.info("t estGetClai ms_Success :" + s.and Return().g etResponse ().getStat us()); | |
128 | asse rtFalse(Ht tpStatus.O K.value() != s.andRe turn().get Response() .getStatus ()); | |
129 | } | |
130 | ||
131 | /* * | |
132 | * Tests for an EWV Pr ofessional Claim fro m the EWV Database u sing Sprin g MockMvc Framework call to | |
133 | * the "/api /v1/ewvCla im/{pdiNum ber}" REST Ful Web Se rvice. | |
134 | * | |
135 | * @throws E xception - if some e rror occur s | |
136 | * / | |
137 | @T est | |
138 | @I gnore | |
139 | pu blic void getiDetail Prof_succe ss() throw s Exceptio n { | |
140 | ||
141 | Resu ltActions s = mockMv c.perform( get("/api/ v1/ewvClai m/{pdiNumb er}", "200 6172030006 06")).andD o(print()) | |
142 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
143 | ||
144 | logg er.info("t estGetClai ms_Success :" + s.and Return().g etResponse ().getStat us()); | |
145 | asse rtFalse(Ht tpStatus.O K.value() != s.andRe turn().get Response() .getStatus ()); | |
146 | } | |
147 | ||
148 | /* * | |
149 | * User Stor y 01.11.24 : The EWV system wil l be able to display a POS at the claim level and at the lin e level. | |
150 | * If no lin e level PO S’s are re ceived the system wi ll display the POS a t the clai m level on ly. If a l ine level | |
151 | * POS is re ceived the n the POS will be di splayed at the line level for only that line and d isplay the POS at | |
152 | * the claim level for the remai nder of th e claim. ( BN 2.10) P rofessiona l Claims | |
153 | * | |
154 | * Acceptanc e Criteria : Verify T he EWV sys tem displ ays a POS at the cla im level a nd at the line level . | |
155 | * If no lin e level PO S’s are re ceived the system wi ll display the POS a t the clai m level on ly. If a l ine | |
156 | * level POS is receiv ed then th e POS will be displa yed at the line leve l for only that line and displ ay | |
157 | * the POS a t the clai m level fo r the rema inder of t he claim. | |
158 | * | |
159 | * Tests for a Profess ional Clai m that has some Serv ice Lines with POS a nd some th at do not. | |
160 | * Just visu ally inspe ct JSON Re sponse to see that t hat's the response. Tests usin g Spring M ockMvc Fra mework | |
161 | * call to t he "/api/v 1/ewvClaim /{pdiNumbe r}" RESTFu l Web Serv ice. | |
162 | * | |
163 | * @throws E xception - if some e rror occur s | |
164 | * / | |
165 | @T est | |
166 | @I gnore | |
167 | pu blic void getDetailP rof_pos_su ccess() th rows Excep tion { | |
168 | ||
169 | Resu ltActions s = mockMv c.perform( get("/api/ v1/ewvClai m/{pdiNumb er}", "100 0000000018 00")).andD o(print()) | |
170 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
171 | ||
172 | logg er.info("t estGetClai ms_Success :" + s.and Return().g etResponse ().getStat us()); | |
173 | asse rtFalse(Ht tpStatus.O K.value() != s.andRe turn().get Response() .getStatus ()); | |
174 | } | |
175 | ||
176 | /* * | |
177 | * Tests for attemptin g to obtai n an EWV C laim that does not e xist in th e EWV Data base using Spring Mo ckMvc | |
178 | * Framework call to t he "/api/v 1/ewvClaim /{pdiNumbe r}" RESTFu l Web Serv ice. | |
179 | * | |
180 | * @throws E xception - if an err or occurs | |
181 | * / | |
182 | @T est | |
183 | @I gnore | |
184 | pu blic void getDetail_ fail() thr ows Except ion { | |
185 | ||
186 | Resu ltActions s = mockMv c.perform( get("/api/ v1/ewvClai m/{pdiNumb er}", "123 ")).andDo( print()) | |
187 | .andExpe ct(content ().content Type("appl ication/js on;charset =UTF-8")); | |
188 | ||
189 | logg er.info("g etDetail_f ail:" + s. andReturn( ).getRespo nse().getS tatus()); | |
190 | ||
191 | } | |
192 | ||
193 | /* * | |
194 | * Tests for getting a ll the PDG Reference s in the E WV Databas e using Sp ring MockM vc Framewo rk call to | |
195 | * the "/api /v1/pdfRef erence/get AllPdfRefe rences" RE STFul Web Service. | |
196 | * | |
197 | * @throws E xception - if an err or occurs | |
198 | * / | |
199 | @T est | |
200 | @I gnore | |
201 | pu blic void getAllPdfR eferences_ success() throws Exc eption { | |
202 | ||
203 | Resu ltActions s = mockMv c.perform( get("/api/ v1/pdfRefe rence/getA llPdfRefer ences")).a ndDo(print ()) | |
204 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
205 | ||
206 | logg er.info("t est getAll PdfReferen ces_succes s: " + s.a ndReturn() .getRespon se().getSt atus()); | |
207 | asse rtTrue(Htt pStatus.OK .value() = = s.andRet urn().getR esponse(). getStatus( )); | |
208 | } | |
209 | ||
210 | /* * | |
211 | * Tests the successfu l Uploadin g of one f ile using Spring Moc kMvc Frame work call to the | |
212 | * "/api/v1/ fileupload " RESTFul Web Servic e. | |
213 | * | |
214 | * @throws E xception - if an err or occurs | |
215 | * / | |
216 | @T est | |
217 | @I gnore | |
218 | pu blic void fileupload _oneFile_s uccess() t hrows Exce ption { | |
219 | File UploadRequ est fileUp loadReques t = new Fi leUploadRe quest(); | |
220 | Mock MultipartF ile file = new MockM ultipartFi le("file" + System.c urrentTime Millis(), "hello" + System.cur rentTimeMi llis() + " .txt", | |
221 | MediaT ype.TEXT_P LAIN_VALUE , "Hello, World!".ge tBytes()); | |
222 | List <Multipart File> mult ipartFiles List = new ArrayList <Multipart File>(); | |
223 | mult ipartFiles List.add(f ile); | |
224 | file UploadRequ est.setMul tipartFile s(multipar tFilesList ); | |
225 | ||
226 | Resu ltActions s = mockMv c.perform( post("/ap i/v1/fileu pload").co ntentType( "multipart /form-data ;boundary= " + System .currentTi meMillis() ) | |
227 | .flash Attr("file UploadRequ est", file UploadRequ est)).andD o(print()) | |
228 | .andEx pect(statu s().isOk() ).andExpec t(content( ).contentT ype("appli cation/jso n;charset= UTF-8")); | |
229 | ||
230 | logg er.info("t est fileup load_oneFi le_success : " + s.an dReturn(). getRespons e().getSta tus()); | |
231 | asse rtTrue(Htt pStatus.OK .value() = = s.andRet urn().getR esponse(). getStatus( )); | |
232 | } | |
233 | ||
234 | /* * | |
235 | * Tests the successfu l Uploadin g of two f iles using Spring Mo ckMvc Fram ework call to the | |
236 | * "/api/v1/ fileupload " RESTFul Web Servic e. | |
237 | * | |
238 | * @throws E xception - if an err or occurs | |
239 | * / | |
240 | @T est | |
241 | @I gnore | |
242 | pu blic void fileupload _twoFiles_ success() throws Exc eption { | |
243 | File UploadRequ est fileUp loadReques t = new Fi leUploadRe quest(); | |
244 | List <Multipart File> mult ipartFiles List = new ArrayList <Multipart File>(); | |
245 | ||
246 | Mock MultipartF ile file = new MockM ultipartFi le("fileHe llo" + Sys tem.curren tTimeMilli s(), "hell o" + Syste m.currentT imeMillis( ) + ".txt" , | |
247 | MediaT ype.TEXT_P LAIN_VALUE , "Hello, World!".ge tBytes()); | |
248 | mult ipartFiles List.add(f ile); | |
249 | ||
250 | file = new Moc kMultipart File("file Goodbye" + System.cu rrentTimeM illis(), " goodbye" + System.cu rrentTimeM illis() + ".txt", | |
251 | MediaTyp e.TEXT_PLA IN_VALUE, "Goodbye, World!".ge tBytes()); | |
252 | mult ipartFiles List.add(f ile); | |
253 | ||
254 | file UploadRequ est.setMul tipartFile s(multipar tFilesList ); | |
255 | ||
256 | Resu ltActions s = mockMv c.perform( post("/ap i/v1/fileu pload").co ntentType( "multipart /form-data ;boundary= " + System .currentTi meMillis() ) | |
257 | .flash Attr("file UploadRequ est", file UploadRequ est)).andD o(print()) | |
258 | .andEx pect(statu s().isOk() ).andExpec t(content( ).contentT ype("appli cation/jso n;charset= UTF-8")); | |
259 | ||
260 | logg er.info("t est fileup load_twoFi les_succes s: " + s.a ndReturn() .getRespon se().getSt atus()); | |
261 | asse rtTrue(Htt pStatus.OK .value() = = s.andRet urn().getR esponse(). getStatus( )); | |
262 | } | |
263 | ||
264 | /* * | |
265 | * Tests th e successf ul Uploadi ng of two files and un-success ful Upload ing of two files usi ng | |
266 | * Spring M ockMvc Fra mework cal l to the " /api/v1/fi leupload" RESTFul We b Service. | |
267 | * | |
268 | * @throws E xception - if an err or occurs | |
269 | * / | |
270 | @T est | |
271 | @I gnore | |
272 | pu blic void fileupload _twoFiles_ success_tw oFiles_err or() throw s Exceptio n { | |
273 | File UploadRequ est fileUp loadReques t = new Fi leUploadRe quest(); | |
274 | List <Multipart File> mult ipartFiles List = new ArrayList <Multipart File>(); | |
275 | ||
276 | Mock MultipartF ile file = new MockM ultipartFi le("fileHe llo" + Sys tem.curren tTimeMilli s(), "hell o" + Syste m.currentT imeMillis( ) + ".txt" , | |
277 | MediaT ype.TEXT_P LAIN_VALUE , "Hello, World!".ge tBytes()); | |
278 | mult ipartFiles List.add(f ile); | |
279 | mult ipartFiles List.add(f ile); | |
280 | ||
281 | file = new Moc kMultipart File("file Goodbye" + System.cu rrentTimeM illis(), " goodbye" + System.cu rrentTimeM illis() + ".txt", | |
282 | MediaTyp e.TEXT_PLA IN_VALUE, "Goodbye, World!".ge tBytes()); | |
283 | mult ipartFiles List.add(f ile); | |
284 | mult ipartFiles List.add(f ile); | |
285 | ||
286 | file UploadRequ est.setMul tipartFile s(multipar tFilesList ); | |
287 | ||
288 | Resu ltActions s = mockMv c.perform( post("/ap i/v1/fileu pload").co ntentType( "multipart /form-data ;boundary= " + System .currentTi meMillis() ) | |
289 | .flash Attr("file UploadRequ est", file UploadRequ est)).andD o(print()) | |
290 | .andEx pect(statu s().isOk() ).andExpec t(content( ).contentT ype("appli cation/jso n;charset= UTF-8")); | |
291 | ||
292 | logg er.info("t est fileup load_twoFi les_succes s_twoFiles _error: " + s.andRet urn().getR esponse(). getStatus( )); | |
293 | asse rtTrue(Htt pStatus.OK .value() = = s.andRet urn().getR esponse(). getStatus( )); | |
294 | } | |
295 | ||
296 | /* * | |
297 | * Tests the successfu l Archivin g of one f ile using Spring Moc kMvc Frame work call to the | |
298 | * "/api/v1/ filearchiv e" RESTFul Web Servi ce. | |
299 | * | |
300 | * @throws E xception - if an err or occurs | |
301 | * / | |
302 | @T est | |
303 | @I gnore | |
304 | pu blic void filearchiv e_oneFile_ success() throws Exc eption { | |
305 | Arch iveFileReq uest archi veFileRequ est = new ArchiveFil eRequest() ; | |
306 | List <Archived PdfReferen ce> archiv edPdfRefer encesList = new Arra yList<Arch ivedPdfRef erence>(); | |
307 | ||
308 | Arch ivedPdfRef erence arc hivedPdfRe ference = new Archiv edPdfRefer ence(); | |
309 | BigD ecimal gui d = new Bi gDecimal(7 52); | |
310 | arch ivedPdfRef erence.set Guid(guid. toPlainStr ing()); | |
311 | arch ivedPdfRef erence.set Alt("hello 1530564724 915 (old)" ); | |
312 | arch ivedPdfRef erencesLis t.add(arch ivedPdfRef erence); | |
313 | ||
314 | arch iveFileReq uest.setAr chivedPdfR eferences( archivedPd fReference sList); | |
315 | ||
316 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
317 | mapp er.configu re(Seriali zationFeat ure.WRAP_R OOT_VALUE, false); | |
318 | Obje ctWriter o w = mapper .writer(). withDefaul tPrettyPri nter(); | |
319 | Stri ng jsonReq uest = ow. writeValue AsString(a rchiveFile Request); | |
320 | ||
321 | // S ystem.out. println("j sonRequest = " + jso nRequest); | |
322 | ||
323 | Resu ltActions s = mockMv c.perform( post("/ap i/v1/filea rchive").c ontentType (MediaType .APPLICATI ON_JSON) | |
324 | .content (jsonReque st)).andDo (print()) | |
325 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
326 | ||
327 | logg er.info("t est filear chive_oneF ile_succes s: " + s.a ndReturn() .getRespon se().getSt atus()); | |
328 | asse rtTrue(Htt pStatus.OK .value() = = s.andRet urn().getR esponse(). getStatus( )); | |
329 | } | |
330 | ||
331 | /* * | |
332 | * Tests the successfu l Archivin g of two f iles using Spring Mo ckMvc Fram ework call to the | |
333 | * "/api/v1/ filearchiv e" RESTFul Web Servi ce. | |
334 | * | |
335 | * @throws E xception - if an err or occurs | |
336 | * / | |
337 | @T est | |
338 | @I gnore | |
339 | pu blic void filearchiv e_twoFiles _success() throws Ex ception { | |
340 | Arch iveFileReq uest archi veFileRequ est = new ArchiveFil eRequest() ; | |
341 | List <Archived PdfReferen ce> archiv edPdfRefer encesList = new Arra yList<Arch ivedPdfRef erence>(); | |
342 | ||
343 | Arch ivedPdfRef erence arc hivedPdfRe ference = new Archiv edPdfRefer ence(); | |
344 | BigD ecimal gui d = new Bi gDecimal(7 52); | |
345 | arch ivedPdfRef erence.set Guid(guid. toPlainStr ing()); | |
346 | arch ivedPdfRef erence.set Alt("hello 1530564724 915 (old)" ); | |
347 | arch ivedPdfRef erencesLis t.add(arch ivedPdfRef erence); | |
348 | ||
349 | arch ivedPdfRef erence = n ew Archive dPdfRefere nce(); | |
350 | guid = new Big Decimal(75 3); | |
351 | arch ivedPdfRef erence.set Guid(guid. toPlainStr ing()); | |
352 | arch ivedPdfRef erence.set Alt("goodb ye15305647 24915 (old )"); | |
353 | arch ivedPdfRef erencesLis t.add(arch ivedPdfRef erence); | |
354 | ||
355 | arch iveFileReq uest.setAr chivedPdfR eferences( archivedPd fReference sList); | |
356 | ||
357 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
358 | mapp er.configu re(Seriali zationFeat ure.WRAP_R OOT_VALUE, false); | |
359 | Obje ctWriter o w = mapper .writer(). withDefaul tPrettyPri nter(); | |
360 | Stri ng jsonReq uest = ow. writeValue AsString(a rchiveFile Request); | |
361 | ||
362 | // S ystem.out. println("j sonRequest = " + jso nRequest); | |
363 | ||
364 | Resu ltActions s = mockMv c.perform( post("/ap i/v1/filea rchive").c ontentType (MediaType .APPLICATI ON_JSON) | |
365 | .content (jsonReque st)).andDo (print()) | |
366 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
367 | ||
368 | logg er.info("t est filear chive_oneF ile_succes s: " + s.a ndReturn() .getRespon se().getSt atus()); | |
369 | asse rtTrue(Htt pStatus.OK .value() = = s.andRet urn().getR esponse(). getStatus( )); | |
370 | } | |
371 | ||
372 | /* * | |
373 | * Tests the successfu l Archivin g of two f iles and u n-successf ul Arching of one fi le using S pring | |
374 | * MockMvc F ramework c all to the "/api/v1/ filearchiv e" RESTFul Web Servi ce. | |
375 | * | |
376 | * @throws E xception - if an err or occurs | |
377 | * / | |
378 | @T est | |
379 | @I gnore | |
380 | pu blic void filearchiv e_twoFiles _success_o neFile_err or() throw s Exceptio n { | |
381 | Arch iveFileReq uest archi veFileRequ est = new ArchiveFil eRequest() ; | |
382 | List <Archived PdfReferen ce> archiv edPdfRefer encesList = new Arra yList<Arch ivedPdfRef erence>(); | |
383 | ||
384 | Arch ivedPdfRef erence arc hivedPdfRe ference = new Archiv edPdfRefer ence(); | |
385 | BigD ecimal gui d = new Bi gDecimal(7 52); // ex ists | |
386 | arch ivedPdfRef erence.set Guid(guid. toPlainStr ing()); | |
387 | arch ivedPdfRef erence.set Alt("hello 1530564724 915 (old)" ); | |
388 | arch ivedPdfRef erencesLis t.add(arch ivedPdfRef erence); | |
389 | ||
390 | arch ivedPdfRef erence = n ew Archive dPdfRefere nce(); | |
391 | guid = new Big Decimal(75 3); // exi sts | |
392 | arch ivedPdfRef erence.set Guid(guid. toPlainStr ing()); | |
393 | arch ivedPdfRef erence.set Alt("goodb ye15305647 24915 (old )"); | |
394 | arch ivedPdfRef erencesLis t.add(arch ivedPdfRef erence); | |
395 | ||
396 | arch ivedPdfRef erence = n ew Archive dPdfRefere nce(); | |
397 | guid = new Big Decimal(10 0); // doe s not exis t | |
398 | arch ivedPdfRef erence.set Guid(guid. toPlainStr ing()); | |
399 | arch ivedPdfRef erence.set Alt("goodb ye15305647 24915 (old )"); | |
400 | arch ivedPdfRef erencesLis t.add(arch ivedPdfRef erence); | |
401 | ||
402 | arch iveFileReq uest.setAr chivedPdfR eferences( archivedPd fReference sList); | |
403 | ||
404 | Obje ctMapper m apper = ne w ObjectMa pper(); | |
405 | mapp er.configu re(Seriali zationFeat ure.WRAP_R OOT_VALUE, false); | |
406 | Obje ctWriter o w = mapper .writer(). withDefaul tPrettyPri nter(); | |
407 | Stri ng jsonReq uest = ow. writeValue AsString(a rchiveFile Request); | |
408 | ||
409 | // S ystem.out. println("j sonRequest = " + jso nRequest); | |
410 | ||
411 | Resu ltActions s = mockMv c.perform( post("/ap i/v1/filea rchive").c ontentType (MediaType .APPLICATI ON_JSON) | |
412 | .content (jsonReque st)).andDo (print()) | |
413 | .andExpe ct(status( ).isOk()). andExpect( content(). contentTyp e("applica tion/json; charset=UT F-8")); | |
414 | ||
415 | logg er.info("t est filear chive_oneF ile_succes s: " + s.a ndReturn() .getRespon se().getSt atus()); | |
416 | asse rtTrue(Htt pStatus.OK .value() = = s.andRet urn().getR esponse(). getStatus( )); | |
417 | } | |
418 | } | |
419 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.