Produced by Araxis Merge on 4/2/2019 1:06:58 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\util | NullsLastComparatorTest.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\util | NullsLastComparatorTest.java | Thu Mar 28 17:51:22 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 700 |
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 | /** | |
2 | * | |
3 | */ | |
4 | package go v.va.med.e wv.util; | |
5 | ||
6 | import sta tic org.ju nit.Assert .*; | |
7 | ||
8 | import org .junit.Aft er; | |
9 | import org .junit.Aft erClass; | |
10 | import org .junit.Bef ore; | |
11 | import org .junit.Bef oreClass; | |
12 | ||
13 | import org .junit.Tes t; | |
14 | ||
15 | import jav a.math.Big Decimal; | |
16 | import jav a.time.Loc alDate; | |
17 | ||
18 | import sta tic gov.va .med.ewv.u til.NullsL astCompara tor.*; | |
19 | ||
20 | /** | |
21 | * @author DNS xxgeB | |
22 | * | |
23 | */ | |
24 | public cla ss NullsLa stComparat orTest { | |
25 | ||
26 | // Check res ults of co mpare(a,b) | |
27 | st atic void assertLT(i nt cmp) { assertTrue (cmp < 0); } | |
28 | st atic void assertEQ(i nt cmp) { assertTrue (cmp == 0) ; } | |
29 | st atic void assertGT(i nt cmp) { assertTrue (cmp > 0); } | |
30 | /* * | |
31 | * @throws j ava.lang.E xception | |
32 | * / | |
33 | @B eforeClass | |
34 | pu blic stati c void set UpBeforeCl ass() thro ws Excepti on { | |
35 | } | |
36 | ||
37 | /* * | |
38 | * @throws j ava.lang.E xception | |
39 | * / | |
40 | @A fterClass | |
41 | pu blic stati c void tea rDownAfter Class() th rows Excep tion { | |
42 | } | |
43 | ||
44 | /* * | |
45 | * @throws j ava.lang.E xception | |
46 | * / | |
47 | @B efore | |
48 | pu blic void setUp() th rows Excep tion { | |
49 | } | |
50 | ||
51 | /* * | |
52 | * @throws j ava.lang.E xception | |
53 | * / | |
54 | @A fter | |
55 | pu blic void tearDown() throws Ex ception { | |
56 | } | |
57 | ||
58 | /* * | |
59 | * Test meth od for {@l ink gov.va .med.ewv.u til.NullsL astCompara tor#nullsL astBigDeci malCompara tor.compar e(java.mat h.BigDecim al, java.m ath.BigDec imal)}. | |
60 | * / | |
61 | @T est | |
62 | pu blic void test_nulls LastBigDec imalCompar ator() { | |
63 | ||
64 | BigD ecimal noV al = null; | |
65 | BigD ecimal loV al = BigDe cimal.valu eOf(1.5); | |
66 | BigD ecimal hiV al = BigDe cimal.valu eOf(1.5e6) ; | |
67 | ||
68 | // U se nullsLa stBigDecim alComparat or | |
69 | asse rtEQ(nulls LastBigDec imalCompar ator.compa re(loVal, loVal)); | |
70 | asse rtEQ(nulls LastBigDec imalCompar ator.compa re(hiVal, hiVal)); | |
71 | asse rtLT(nulls LastBigDec imalCompar ator.compa re(loVal, hiVal)); | |
72 | asse rtGT(nulls LastBigDec imalCompar ator.compa re(hiVal, loVal)); | |
73 | ||
74 | asse rtEQ(nulls LastBigDec imalCompar ator.compa re(noVal, noVal)); | |
75 | asse rtLT(nulls LastBigDec imalCompar ator.compa re(loVal, noVal)); | |
76 | asse rtLT(nulls LastBigDec imalCompar ator.compa re(hiVal, noVal)); | |
77 | asse rtGT(nulls LastBigDec imalCompar ator.compa re(noVal, loVal)); | |
78 | asse rtGT(nulls LastBigDec imalCompar ator.compa re(noVal, hiVal)); | |
79 | ||
80 | } | |
81 | ||
82 | /* * | |
83 | * Test meth od for {@l ink gov.va .med.ewv.u til.NullsL astCompara tor#compar e(java.mat h.BigDecim al, java.m ath.BigDec imal)}. | |
84 | * / | |
85 | @T est | |
86 | pu blic void testCompar eBigDecima lBigDecima l() { | |
87 | ||
88 | BigD ecimal noV al = null; | |
89 | BigD ecimal loV al = BigDe cimal.valu eOf(1.5); | |
90 | BigD ecimal hiV al = BigDe cimal.valu eOf(1.5e6) ; | |
91 | ||
92 | asse rtEQ(Nulls LastCompar ator.compa re(loVal, loVal)); | |
93 | asse rtEQ(Nulls LastCompar ator.compa re(hiVal, hiVal)); | |
94 | asse rtLT(Nulls LastCompar ator.compa re(loVal, hiVal)); | |
95 | asse rtGT(Nulls LastCompar ator.compa re(hiVal, loVal)); | |
96 | ||
97 | asse rtEQ(Nulls LastCompar ator.compa re(noVal, noVal)); | |
98 | asse rtLT(Nulls LastCompar ator.compa re(loVal, noVal)); | |
99 | asse rtLT(Nulls LastCompar ator.compa re(hiVal, noVal)); | |
100 | asse rtGT(Nulls LastCompar ator.compa re(noVal, loVal)); | |
101 | asse rtGT(Nulls LastCompar ator.compa re(noVal, hiVal)); | |
102 | ||
103 | // S hould be o verloaded | |
104 | asse rtEQ(compa re(loVal, loVal)); | |
105 | asse rtEQ(compa re(hiVal, hiVal)); | |
106 | asse rtLT(compa re(loVal, hiVal)); | |
107 | asse rtGT(compa re(hiVal, loVal)); | |
108 | ||
109 | asse rtEQ(compa re(noVal, noVal)); | |
110 | asse rtLT(compa re(loVal, noVal)); | |
111 | asse rtLT(compa re(hiVal, noVal)); | |
112 | asse rtGT(compa re(noVal, loVal)); | |
113 | asse rtGT(compa re(noVal, hiVal)); | |
114 | ||
115 | } | |
116 | ||
117 | /* * | |
118 | * Test meth od for {@l ink gov.va .med.ewv.u til.NullsL astCompara tor#localD ateUSA(Str ing)}. | |
119 | * / | |
120 | @T est | |
121 | pu blic void test_local DateUSA() { | |
122 | int year = 201 8; | |
123 | int month = 10 ; | |
124 | int dayOfMonth = 25; | |
125 | Loca lDate some dayExpect = LocalDat e.of(year, month, da yOfMonth); | |
126 | Stri ng someday Arg = "10/ 25/2018"; | |
127 | Loca lDate some dayActual = localDat eUSA(somed ayArg); | |
128 | asse rtEquals(s omedayExpe ct, someda yActual); | |
129 | ||
130 | // T ry null, s hould retu rn null | |
131 | Stri ng noArg = null; | |
132 | Loca lDate null Actual = l ocalDateUS A(noArg); | |
133 | asse rtNull(nul lActual); | |
134 | ||
135 | // T ry malform ed dates, should all return nu ll | |
136 | Stri ng[] xxArg s = { | |
137 | "10/25/2 018,", // too long | |
138 | "", | |
139 | "oops", | |
140 | "10-25-2 018", | |
141 | "10.25.2 018", | |
142 | "1025201 8", | |
143 | "2018/10 /25", | |
144 | "2018-10 -25", | |
145 | "10-25-2 018", | |
146 | }; // OK to h ave ,} | |
147 | // Y ou could h ave millio ns of inco rrect valu es. | |
148 | for (String xx Arg : xxAr gs) { | |
149 | LocalD ate xxActu al = Nulls LastCompar ator.local DateUSA(xx Arg); | |
150 | assert Null(xxAct ual); | |
151 | } | |
152 | } | |
153 | ||
154 | /* * | |
155 | * Test meth od for {@l ink gov.va .med.ewv.u til.NullsL astCompara tor#localD ateUSA(Str ing)}. | |
156 | * / | |
157 | @T est | |
158 | pu blic void test_local DateUSA_st atic() { | |
159 | int year = 201 8; | |
160 | int month = 10 ; | |
161 | int dayOfMonth = 25; | |
162 | Loca lDate some dayExpect = LocalDat e.of(year, month, da yOfMonth); | |
163 | Stri ng someday Arg = "10/ 25/2018"; | |
164 | Loca lDate some dayActual = localDat eUSA(somed ayArg); | |
165 | asse rtEquals(s omedayExpe ct, someda yActual); | |
166 | ||
167 | // T ry null, s hould retu rn null | |
168 | Stri ng noArg = null; | |
169 | Loca lDate null Actual = l ocalDateUS A(noArg); | |
170 | asse rtNull(nul lActual); | |
171 | ||
172 | // T ry malform ed dates, should all return nu ll | |
173 | Stri ng[] xxArg s = { | |
174 | "10/25/2 018,", // too long | |
175 | "", | |
176 | "oops", | |
177 | "10-25-2 018", | |
178 | "10.25.2 018", | |
179 | "1025201 8", | |
180 | "2018/10 /25", | |
181 | "2018-10 -25", | |
182 | "10-25-2 018", | |
183 | }; // OK to h ave ,} | |
184 | // Y ou could h ave millio ns of inco rrect valu es. | |
185 | for (String xx Arg : xxAr gs) { | |
186 | LocalD ate xxActu al = local DateUSA(xx Arg); | |
187 | assert Null(xxAct ual); | |
188 | } | |
189 | } | |
190 | ||
191 | /* * | |
192 | * Test meth od for {@l ink gov.va .med.ewv.u til.NullsL astCompara tor#nullsL astLocalDa teStringCo mparator}. | |
193 | * / | |
194 | @T est | |
195 | pu blic void test_nulls LastLocalD ateStringC omparator( ) { | |
196 | Stri ng noVal = null; | |
197 | // C hoose valu es that wo uld sort i n the oppo site order as String s | |
198 | Stri ng loVal = "10/25/10 18"; | |
199 | Stri ng hiVal = "01/01/20 18"; | |
200 | ||
201 | asse rtEQ(nulls LastLocalD ateStringC omparator. compare(lo Val, loVal )); | |
202 | asse rtEQ(nulls LastLocalD ateStringC omparator. compare(hi Val, hiVal )); | |
203 | asse rtLT(nulls LastLocalD ateStringC omparator. compare(lo Val, hiVal )); | |
204 | asse rtGT(nulls LastLocalD ateStringC omparator. compare(hi Val, loVal )); | |
205 | ||
206 | asse rtEQ(nulls LastLocalD ateStringC omparator. compare(no Val, noVal )); | |
207 | asse rtLT(nulls LastLocalD ateStringC omparator. compare(lo Val, noVal )); | |
208 | asse rtLT(nulls LastLocalD ateStringC omparator. compare(hi Val, noVal )); | |
209 | asse rtGT(nulls LastLocalD ateStringC omparator. compare(no Val, loVal )); | |
210 | asse rtGT(nulls LastLocalD ateStringC omparator. compare(no Val, hiVal )); | |
211 | ||
212 | // T ry malform ed dates, should all return nu ll, get so rted last | |
213 | Stri ng[] xxArg s = { | |
214 | "10/25/2 018,", // too long | |
215 | "", | |
216 | "oops", | |
217 | "10-25-2 018", | |
218 | "10.25.2 018", | |
219 | "1025201 8", | |
220 | "2018/10 /25", | |
221 | "2018-10 -25", | |
222 | "10-25-2 018", | |
223 | }; // OK to h ave ,} | |
224 | // Y ou could h ave millio ns of inco rrect valu es. | |
225 | for (String xx Val : xxAr gs) { | |
226 | assert EQ(nullsLa stLocalDat eStringCom parator.co mpare(xxVa l, xxVal)) ; | |
227 | assert LT(nullsLa stLocalDat eStringCom parator.co mpare(loVa l, xxVal)) ; | |
228 | assert LT(nullsLa stLocalDat eStringCom parator.co mpare(hiVa l, xxVal)) ; | |
229 | assert GT(nullsLa stLocalDat eStringCom parator.co mpare(xxVa l, loVal)) ; | |
230 | assert GT(nullsLa stLocalDat eStringCom parator.co mpare(xxVa l, hiVal)) ; | |
231 | } | |
232 | } | |
233 | ||
234 | /* *nullsLast LocalDateS tringCompa rator | |
235 | * Test meth od for {@l ink gov.va .med.ewv.u til.NullsL astCompara tor#compar e(java.tim e.LocalDat e, java.ti me.LocalDa te)}. | |
236 | * / | |
237 | @T est | |
238 | pu blic void test_nulls LastLocalD ateCompara tor() { | |
239 | Loca lDate noVa l = null; | |
240 | int year = 201 8; | |
241 | int month = 10 ; | |
242 | int dayOfMonth = 25; | |
243 | Loca lDate loVa l = LocalD ate.of(yea r, month, dayOfMonth ); | |
244 | Loca lDate hiVa l = LocalD ate.of(252 5, month, dayOfMonth ); | |
245 | ||
246 | // C heck natur al order | |
247 | asse rtEQ(loVal .compareTo (loVal)); | |
248 | asse rtEQ(hiVal .compareTo (hiVal)); | |
249 | asse rtLT(loVal .compareTo (hiVal)); | |
250 | asse rtGT(hiVal .compareTo (loVal)); | |
251 | ||
252 | asse rtEQ(nulls LastLocalD ateCompara tor.compar e(loVal, l oVal)); | |
253 | asse rtEQ(nulls LastLocalD ateCompara tor.compar e(hiVal, h iVal)); | |
254 | asse rtLT(nulls LastLocalD ateCompara tor.compar e(loVal, h iVal)); | |
255 | asse rtGT(nulls LastLocalD ateCompara tor.compar e(hiVal, l oVal)); | |
256 | ||
257 | asse rtEQ(nulls LastLocalD ateCompara tor.compar e(noVal, n oVal)); | |
258 | asse rtLT(nulls LastLocalD ateCompara tor.compar e(loVal, n oVal)); | |
259 | asse rtLT(nulls LastLocalD ateCompara tor.compar e(hiVal, n oVal)); | |
260 | asse rtGT(nulls LastLocalD ateCompara tor.compar e(noVal, l oVal)); | |
261 | asse rtGT(nulls LastLocalD ateCompara tor.compar e(noVal, h iVal)); | |
262 | ||
263 | // o verloaded static com pare | |
264 | asse rtEQ(compa re(loVal, loVal)); | |
265 | asse rtEQ(compa re(hiVal, hiVal)); | |
266 | asse rtLT(compa re(loVal, hiVal)); | |
267 | asse rtGT(compa re(hiVal, loVal)); | |
268 | ||
269 | asse rtEQ(compa re(noVal, noVal)); | |
270 | asse rtLT(compa re(loVal, noVal)); | |
271 | asse rtLT(compa re(hiVal, noVal)); | |
272 | asse rtGT(compa re(noVal, loVal)); | |
273 | asse rtGT(compa re(noVal, hiVal)); | |
274 | ||
275 | } | |
276 | ||
277 | /* * | |
278 | * Test meth od for {@l ink gov.va .med.ewv.u til.NullsL astCompara tor#compar e(java.lan g.String, java.lang. String)}. | |
279 | * / | |
280 | @T est | |
281 | pu blic void testCompar eStringStr ing() { | |
282 | Stri ng noVal = null; | |
283 | // C hoose valu es that wo uld sort i n the oppo site order as LocalD ate String s | |
284 | Stri ng loVal = "01/01/20 18"; | |
285 | Stri ng hiVal = "10/25/10 18"; | |
286 | ||
287 | asse rtEQ(nulls LastString Comparator .compare(l oVal, loVa l)); | |
288 | asse rtEQ(nulls LastString Comparator .compare(h iVal, hiVa l)); | |
289 | asse rtLT(nulls LastString Comparator .compare(l oVal, hiVa l)); | |
290 | asse rtGT(nulls LastString Comparator .compare(h iVal, loVa l)); | |
291 | ||
292 | asse rtEQ(nulls LastString Comparator .compare(n oVal, noVa l)); | |
293 | asse rtLT(nulls LastString Comparator .compare(l oVal, noVa l)); | |
294 | asse rtLT(nulls LastString Comparator .compare(h iVal, noVa l)); | |
295 | asse rtGT(nulls LastString Comparator .compare(n oVal, loVa l)); | |
296 | asse rtGT(nulls LastString Comparator .compare(n oVal, hiVa l)); | |
297 | ||
298 | asse rtLT(nulls LastString Comparator .compare(" ", noVal)) ; | |
299 | asse rtGT(nulls LastString Comparator .compare(n oVal,"")); | |
300 | asse rtEQ(nulls LastString Comparator .compare(" ", "")); | |
301 | ||
302 | asse rtLT(nulls LastString Comparator .compare(" °", noVal )); | |
303 | asse rtGT(nulls LastString Comparator .compare(n oVal,"°") ); | |
304 | asse rtEQ(nulls LastString Comparator .compare(" °", "°") ); | |
305 | ||
306 | asse rtLT(nulls LastString Comparator .compare(" ", "°")); | |
307 | asse rtGT(nulls LastString Comparator .compare(" °","")); | |
308 | ||
309 | asse rtLT(nulls LastString Comparator .compare(" ", " ")); | |
310 | asse rtGT(nulls LastString Comparator .compare(" ","")); | |
311 | ||
312 | } | |
313 | ||
314 | ||
315 | /* * | |
316 | * Test meth od for {@l ink gov.va .med.ewv.u til.NullsL astCompara tor#compar e(java.lan g.String, java.lang. String)}. | |
317 | * / | |
318 | @T est | |
319 | pu blic void testCompar eStringStr ing_static () { | |
320 | Stri ng noVal = null; | |
321 | // C hoose valu es that wo uld sort i n the oppo site order as LocalD ate String s | |
322 | Stri ng loVal = "01/01/20 18"; | |
323 | Stri ng hiVal = "10/25/10 18"; | |
324 | ||
325 | asse rtEQ(compa re(loVal, loVal)); | |
326 | asse rtEQ(compa re(hiVal, hiVal)); | |
327 | asse rtLT(compa re(loVal, hiVal)); | |
328 | asse rtGT(compa re(hiVal, loVal)); | |
329 | ||
330 | asse rtEQ(compa re(noVal, noVal)); | |
331 | asse rtLT(compa re(loVal, noVal)); | |
332 | asse rtLT(compa re(hiVal, noVal)); | |
333 | asse rtGT(compa re(noVal, loVal)); | |
334 | asse rtGT(compa re(noVal, hiVal)); | |
335 | ||
336 | asse rtLT(compa re("", noV al)); | |
337 | asse rtGT(compa re(noVal," ")); | |
338 | asse rtEQ(compa re("", "") ); | |
339 | ||
340 | asse rtLT(compa re("°", n oVal)); | |
341 | asse rtGT(compa re(noVal," °")); | |
342 | asse rtEQ(compa re("°", " °")); | |
343 | ||
344 | asse rtLT(compa re("", "° ")); | |
345 | asse rtGT(compa re("°","" )); | |
346 | ||
347 | asse rtLT(compa re("", " " )); | |
348 | asse rtGT(compa re(" ","") ); | |
349 | ||
350 | } | |
351 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.