Produced by Araxis Merge on 4/2/2019 1:06:56 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\controller | RfaiRequestSubmitControllerTest.java | Wed Mar 27 19:21:15 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\ARS_Backend\ars_app\src\test\java\gov\va\med\ars\controller | RfaiRequestSubmitControllerTest.java | Thu Mar 28 17:51:10 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 308 |
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.a rs.control ler; | |
2 | ||
3 | import sta tic org.ju nit.Assert .assertEqu als; | |
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. status; | |
12 | ||
13 | import jav a.math.Big Decimal; | |
14 | import jav a.math.Big Integer; | |
15 | import jav a.nio.char set.Charse t; | |
16 | import jav a.util.Arr ayList; | |
17 | import jav a.util.Has hSet; | |
18 | import jav a.util.Lis t; | |
19 | import jav a.util.Set ; | |
20 | ||
21 | import org .junit.Bef ore; | |
22 | import org .junit.Tes t; | |
23 | import org .junit.run ner.RunWit h; | |
24 | import org .mockito.I njectMocks ; | |
25 | import org .mockito.M ock; | |
26 | import org .mockito.M ockito; | |
27 | import org .mockito.M ockitoAnno tations; | |
28 | import org .mockito.r unners.Moc kitoJUnitR unner; | |
29 | import org .springfra mework.htt p.MediaTyp e; | |
30 | import org .springfra mework.tes t.web.serv let.MockMv c; | |
31 | import org .springfra mework.tes t.web.serv let.setup. MockMvcBui lders; | |
32 | ||
33 | import com .fasterxml .jackson.c ore.JsonPr ocessingEx ception; | |
34 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
35 | import com .fasterxml .jackson.d atabind.Ob jectWriter ; | |
36 | import com .fasterxml .jackson.d atabind.Se rializatio nFeature; | |
37 | ||
38 | import gov .va.med.ar s.exceptio ns.Generic Exception; | |
39 | import gov .va.med.ar s.filter.C ORSFilter; | |
40 | import gov .va.med.ar s.model.re sponse.Cod eAndLevel; | |
41 | import gov .va.med.ar s.model.re sponse.Rfa iLineItemR esponse; | |
42 | import gov .va.med.ar s.model.re sponse.Rfa iResponse; | |
43 | import gov .va.med.ar s.service. IRfaiReque stSubmitSe rvice; | |
44 | ||
45 | @RunWith(M ockitoJUni tRunner.cl ass) | |
46 | public cla ss RfaiReq uestSubmit Controller Test { | |
47 | ||
48 | pr ivate Mock Mvc mockMv c; | |
49 | pu blic stati c final Me diaType AP PLICATION_ JSON_UTF8 = new Medi aType(Medi aType.APPL ICATION_JS ON.getType (), | |
50 | MediaT ype.APPLIC ATION_JSON .getSubtyp e(), Chars et.forName ("utf8")); | |
51 | @M ock | |
52 | pr ivate IRfa iRequestSu bmitServic e reqSubmi tService; | |
53 | ||
54 | @I njectMocks | |
55 | pr ivate Rfai RequestSub mitControl ler reqSub mitControl ler; | |
56 | ||
57 | @B efore | |
58 | pu blic void init() thr ows Except ion { | |
59 | Mock itoAnnotat ions.initM ocks(this) ; | |
60 | mock Mvc = Mock MvcBuilder s.standalo neSetup(re qSubmitCon troller).a ddFilters( new CORSFi lter()).bu ild(); | |
61 | ||
62 | } | |
63 | ||
64 | @T est | |
65 | pu blic void testSubmit RfaiReques t_Success( ) throws E xception { | |
66 | Rfai Response r faiRequest = new Rfa iResponse( ); | |
67 | rfai Request.se tClaimId(n ew BigInte ger("10000 ")); | |
68 | rfaiReques t.setConta ctInformat ion(" PII "); | |
69 | rfai Request.se tServiceFr omDate("12 /12/2017") ; | |
70 | rfai Request.se tServiceTo Date("12/1 2/2017"); | |
71 | rfai Request.se tResponseD ate("12/12 /2017"); | |
72 | ||
73 | Set< CodeAndLev el> calLis t = new Ha shSet<>(); | |
74 | Code AndLevel c al1 = new CodeAndLev el(1L, 1L, 1L, 1L, " 0"); | |
75 | Code AndLevel c al2 = new CodeAndLev el(2L, 2L, 2L, 2L, " 0"); | |
76 | calL ist.add(ca l1); | |
77 | calL ist.add(ca l2); | |
78 | rfai Request.se tCodeAndLe velList(ca lList); | |
79 | ||
80 | List <RfaiLineI temRespons e> rfaiLin eItemRespo nse = new ArrayList< RfaiLineIt emResponse >(); | |
81 | Rfai LineItemRe sponse rfa iLine = ne w RfaiLine ItemRespon se(); | |
82 | rfai Line.setSe rviceLineI d(10095L); | |
83 | rfai Line.setCh argeAmount (new BigDe cimal(2.01 )); | |
84 | rfai Line.setMo difiers("m odifier"); | |
85 | rfai Line.setPr ocedureCod e("256"); | |
86 | rfai Line.setRe venueCode( "456"); | |
87 | rfai Line.setSe rviceFrom( "12/12/201 7"); | |
88 | rfai Line.setSe rviceTo("1 2/12/2017" ); | |
89 | rfai Line.setSe rviceLineI d(1000089L ); | |
90 | rfai LineItemRe sponse.add (rfaiLine) ; | |
91 | rfai Request.se tRfaiLineI temRespons e(rfaiLine ItemRespon se); | |
92 | ||
93 | when (reqSubmit Service.su bmitAdditi onalInfoRe quest(Mock ito.any(Rf aiResponse .class))). thenReturn (true); | |
94 | ||
95 | mock Mvc.perfor m(post("/a pi/v1/addi tionalInfo Request"). contentTyp e(MediaTyp e.APPLICAT ION_JSON) | |
96 | .content (getReques tJson(rfai Request))) .andDo(pri nt()).andE xpect(stat us().isCre ated()); | |
97 | ||
98 | veri fy(reqSubm itService, times(1)) .submitAdd itionalInf oRequest(M ockito.any (RfaiRespo nse.class) ); | |
99 | veri fyNoMoreIn teractions (reqSubmit Service); | |
100 | ||
101 | } | |
102 | ||
103 | @T est | |
104 | pu blic void testSubmit RfaiReques t_Failure( ) throws G enericExce ption { | |
105 | Rfai Response r faiRequest = new Rfa iResponse( ); | |
106 | rfaiReques t.setConta ctInformat ion(" PII "); | |
107 | rfai Request.se tServiceFr omDate("12 /12/2017") ; | |
108 | rfai Request.se tServiceTo Date("12/1 2/2017"); | |
109 | rfai Request.se tResponseD ate("12/12 /2017"); | |
110 | Set< CodeAndLev el> calLis t = new Ha shSet<>(); | |
111 | Code AndLevel c al1 = new CodeAndLev el(1L, 1L, 1L, 1L, " 0"); | |
112 | Code AndLevel c al2 = new CodeAndLev el(2L, 2L, 2L, 2L, " 0"); | |
113 | calL ist.add(ca l1); | |
114 | calL ist.add(ca l2); | |
115 | rfai Request.se tCodeAndLe velList(ca lList); | |
116 | ||
117 | List <RfaiLineI temRespons e> rfaiLin eItemRespo nse = new ArrayList< RfaiLineIt emResponse >(); | |
118 | Rfai LineItemRe sponse rfa iLine = ne w RfaiLine ItemRespon se(); | |
119 | rfai Line.setSe rviceLineI d(10095L); | |
120 | rfai Line.setCh argeAmount (new BigDe cimal(2.01 )); | |
121 | rfai Line.setMo difiers("m odifier"); | |
122 | rfai Line.setPr ocedureCod e("256"); | |
123 | rfai Line.setRe venueCode( "456"); | |
124 | rfai Line.setSe rviceFrom( "12/12/201 7"); | |
125 | rfai Line.setSe rviceTo("1 2/12/2017" ); | |
126 | rfai Line.setSe rviceLineI d(1000089L ); | |
127 | rfai LineItemRe sponse.add (rfaiLine) ; | |
128 | rfai Request.se tRfaiLineI temRespons e(rfaiLine ItemRespon se); | |
129 | ||
130 | try { | |
131 | mockMv c.perform( post("/api /v1/additi onalInfoRe quest").co ntentType( MediaType. APPLICATIO N_JSON) | |
132 | .content(g etRequestJ son(rfaiRe quest))).a ndDo(print ()).andExp ect(status ().isBadRe quest()) | |
133 | .andExpect (content() .contentTy pe("applic ation/json ;charset=U TF-8")); | |
134 | } ca tch (Excep tion e) { | |
135 | assert Equals( | |
136 | "Request p rocessing failed; ne sted excep tion is go v.va.med.a rs.excepti ons.Generi cException : Missing ClaimId", | |
137 | e.getMessa ge()); | |
138 | } | |
139 | } | |
140 | ||
141 | pr ivate Stri ng getRequ estJson(Ob ject reque st) { | |
142 | Stri ng request Json = nul l; | |
143 | try { | |
144 | Object Mapper map per = new ObjectMapp er(); | |
145 | mapper .configure (Serializa tionFeatur e.WRAP_ROO T_VALUE, f alse); | |
146 | Object Writer ow = mapper.w riter().wi thDefaultP rettyPrint er(); | |
147 | reques tJson = ow .writeValu eAsString( request); | |
148 | System .out.print ln("reques tJson - " + requestJ son); | |
149 | ||
150 | } ca tch (JsonP rocessingE xception e ) { | |
151 | e.prin tStackTrac e(); | |
152 | } | |
153 | retu rn request Json; | |
154 | } | |
155 | ||
156 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.