Produced by Araxis Merge on 11/28/2017 4:44:48 PM Eastern Standard 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 | admin_portal_reeng_2018.1.0.0.zip\admin portal reeng\mhv_source\mhv_admin\mhv-admin-api\src\main\java\gov\va\med\mhv\admin\util | Precondition.java | Wed Aug 23 04:11:24 2017 UTC |
2 | admin_portal_reeng_2018.1.0.0.zip\admin portal reeng\mhv_source\mhv_admin\mhv-admin-api\src\main\java\gov\va\med\mhv\admin\util | Precondition.java | Tue Nov 28 20:29:25 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 1102 |
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.m hv.admin.u til; | |
2 | ||
3 | import jav a.util.Col lection; | |
4 | import jav a.util.Dat e; | |
5 | import jav a.util.Ite rator; | |
6 | ||
7 | import org .apache.co mmons.lang 3.StringUt ils; | |
8 | ||
9 | /** | |
10 | * Utility methods t o verify p reconditio ns of non- private cl ass method . The | |
11 | * methods of this c lass throw an Illega lArgumentE xception, when the a sserted | |
12 | * conditi on is not met. This supports a programmi ng-by-cont ract style . </p><p> | |
13 | * {@link http://en. wikipedia. org/wiki/P rogramming _by_contra ct "Wikepe dia"}: | |
14 | * <quote> the whole idea is t hat code s hould "fai l hard", w ith the co ntract | |
15 | * verific ation bein g the safe ty net. DB C's "fail hard" prop erty makes debugging | |
16 | * for-con tract beha vior much easier bec ause the i ntended be haviour of each | |
17 | * routine is clearl y specifie d. The con tract cond itions sho uld never be | |
18 | * violate d in progr am executi on. </quot e> </p><p> Example: </p> <pre> public | |
19 | * boolean doTask(My Class myOb ject) { Pr econdition .assertNot Null("myOb ject", | |
20 | * myObjec t); ... } </pre> <p> Furthermo re, this c lass reduc es the ver bosity of | |
21 | * precond ition asse rtion and more clear ly express es the int ent. Compa re the | |
22 | * example to: </p> <pre> publ ic boolean doTask(My Class myOb ject) { if (myObject | |
23 | * == null ) { throw IllegalArg umentExcep tion("myOb ject: " + | |
24 | * " Expec ted a non- null value "); } ... } </pre> < p> For inv ariants an d | |
25 | * post-co nditions a sserts sho uld be use d, as the programmer has contr ol over | |
26 | * these c onditions. Also, for private m ethods ass erts shoul d be used, as the | |
27 | * program mer has co ntrol over these con ditions. < /p> | |
28 | * | |
29 | * @author
|
|
30 | */ | |
31 | public fin al class P reconditio n { | |
32 | ||
33 | // Note: It may be pre ferable to use a 3rd party pro duct that uses a | |
34 | // Java 5 an notation a pproach, t o not clut er the bod y | |
35 | // of the me thods that need to e nforce the precondit ion with | |
36 | // precondit ions, as t hese are n ot the pri mary purpo se of the method | |
37 | // but can s till be ve rbose. | |
38 | ||
39 | pr ivate Prec ondition() { | |
40 | // M ethods of this utili ty class a re all sta tic and sh ould be | |
41 | // r eferenced through th e class | |
42 | } | |
43 | ||
44 | /* * | |
45 | * Asserts t hat the gi ven condit ion is tru e. | |
46 | * | |
47 | * @param me ssage | |
48 | * The mess age to dis play when the condit ion is fal se. | |
49 | * @param co ndition | |
50 | * The cond ition to c heck. | |
51 | * @throws I llegalArgu mentExcept ion | |
52 | * When th e conditio n is false . | |
53 | * / | |
54 | pu blic stati c void ass ertTrue(bo olean cond ition, Str ing messag e) | |
55 | thro ws Illegal ArgumentEx ception { | |
56 | if ( !condition ) { | |
57 | throw new Illega lArgumentE xception(m essage); | |
58 | } | |
59 | } | |
60 | ||
61 | /* * | |
62 | * Asserts t hat the gi ven condit ion is fal se. | |
63 | * | |
64 | * @param co ndition | |
65 | * The cond ition to c heck | |
66 | * @param me ssage | |
67 | * The mess age to dis play when the condit ion is tru e. | |
68 | * @throws I llegalArgu mentExcept ion | |
69 | * When th e conditio n is true. | |
70 | * / | |
71 | pu blic stati c void ass ertFalse(b oolean con dition, St ring messa ge) | |
72 | thro ws Illegal ArgumentEx ception { | |
73 | if ( condition) { | |
74 | throw new Illega lArgumentE xception(m essage); | |
75 | } | |
76 | } | |
77 | ||
78 | /* * | |
79 | * Asserts t hat the gi ven value is not nul l. | |
80 | * | |
81 | * @param ar gument | |
82 | * The name of the ar gument. | |
83 | * @param va lue | |
84 | * The valu e of the a rgument to check. | |
85 | * @throws I llegalArgu mentExcept ion | |
86 | * if valu e is null. | |
87 | * / | |
88 | pu blic stati c void ass ertNotNull (String ar gument, Ob ject value ) | |
89 | thro ws Illegal ArgumentEx ception { | |
90 | if ( value == n ull) { | |
91 | fail(a rgument, " a value", "null"); | |
92 | } | |
93 | } | |
94 | ||
95 | /* * | |
96 | * Asserts t hat the gi ven value is not bla nk (that i s, not nul l or just | |
97 | * containin g whitespa ce). | |
98 | * | |
99 | * @param ar gument | |
100 | * The name of the ar gument. | |
101 | * @param va lue | |
102 | * The valu e of the a rgument to check. | |
103 | * @throws I llegalArgu mentExcept ion | |
104 | * if valu e is blank . | |
105 | * / | |
106 | pu blic stati c void ass ertNotBlan k(String a rgument, S tring valu e) | |
107 | thro ws Illegal ArgumentEx ception { | |
108 | if ( StringUtil s.isBlank( value)) { | |
109 | fail(a rgument, " a non-blan k string", value); | |
110 | } | |
111 | } | |
112 | ||
113 | /* * | |
114 | * Asserts t hat the gi ven argume nt is not null nor a n empty st ring. | |
115 | * | |
116 | * @param ar gument | |
117 | * The name of the ar gument to validate | |
118 | * @param va lue | |
119 | * The valu e of the a rgument to validate | |
120 | * @throws I llegalArgu mentExcept ion | |
121 | * When th e value is null or e mpty | |
122 | * / | |
123 | pu blic stati c void ass ertNotEmpt y(String a rgument, S tring valu e) | |
124 | thro ws Illegal ArgumentEx ception { | |
125 | if ( StringUtil s.isEmpty( value)) { | |
126 | fail(a rgument, " a non-empt y string", value); | |
127 | } | |
128 | } | |
129 | ||
130 | /* * | |
131 | * Asserts t hat the gi ven argume nt is a st ring of a given leng th. | |
132 | * | |
133 | * @param ar gument | |
134 | * The name of the ar gument to validate. | |
135 | * @param va lue | |
136 | * The valu e of the a rgument to validate. | |
137 | * @param le ngth | |
138 | * The requ ired lengt h of the s tring. | |
139 | * @throws I llegalArgu mentExcept ion | |
140 | * When th e value is null, or a string o f length u nequal to | |
141 | * length. | |
142 | * / | |
143 | pu blic stati c void ass ertLength( String arg ument, Str ing value, int lengt h) { | |
144 | asse rtNotNull( argument, value); | |
145 | if ( value.leng th() != le ngth) { | |
146 | fail(a rgument, " a string o f length " + length, value + " (length:" + value.l ength() + ")"); | |
147 | } | |
148 | } | |
149 | ||
150 | /* * | |
151 | * Asserts t hat the gi ven argume nt is a st ring of at least a g iven lengt h. | |
152 | * | |
153 | * @param ar gument | |
154 | * The name of the ar gument to validate. | |
155 | * @param va lue | |
156 | * The valu e of the a rgument to check. | |
157 | * @param le ngth | |
158 | * The mini mal requir ed length | |
159 | * @throws I llegalArgu mentExcept ion | |
160 | * When th e value is null or a string of length le ss than | |
161 | * length. | |
162 | * / | |
163 | pu blic stati c void ass ertMinLeng th(String argument, String val ue, int le ngth) | |
164 | thro ws Illegal ArgumentEx ception { | |
165 | asse rtNotEmpty (argument, value); | |
166 | if ( value.leng th() < len gth) { | |
167 | fail(a rgument, " a string o f at least length " + length, value + " (length: " + value.l ength() + ")"); | |
168 | } | |
169 | } | |
170 | ||
171 | /* * | |
172 | * Asserts t hat the gi ven argume nt is a st ring of at least a g iven lengt h. | |
173 | * | |
174 | * @param ar gument | |
175 | * The name of the ar gument to check. | |
176 | * @param va lue | |
177 | * The valu e of the a rgument to check. | |
178 | * @param le ngth | |
179 | * The maxi mal allowe d length. | |
180 | * @throws I llegalArgu mentExcept ion | |
181 | * When th e value is null or a string wh ich length exceeds | |
182 | * length. | |
183 | * / | |
184 | pu blic stati c void ass ertMaxLeng th(String argument, String val ue, int le ngth) | |
185 | thro ws Illegal ArgumentEx ception { | |
186 | asse rtNotEmpty (argument, value); | |
187 | if ( value.leng th() > len gth) { | |
188 | fail(a rgument, " a string o f at most length " + length, v alue + " ( length:" + value.len gth() + ") "); | |
189 | } | |
190 | } | |
191 | ||
192 | /* * | |
193 | * Asserts t hat two gi ven object s are equa l. Unless both objec ts are nul l, | |
194 | * the equal s() method of value is applied to determ ine equali ty. Two nu ll | |
195 | * objects a re conside red equal. | |
196 | * | |
197 | * @param ar gument | |
198 | * The name of the ar gument. | |
199 | * @param va lue | |
200 | * The valu e of the a rgument to check. | |
201 | * @param eq ualTo | |
202 | * The refe rence obje ct, to whi ch value i s compared . | |
203 | * @throws I llegalArgu mentExcept ion | |
204 | * If valu es are not equals. | |
205 | * / | |
206 | pu blic stati c void ass ertEquals( String arg ument, Obj ect value, Object eq ualTo) | |
207 | thro ws Illegal ArgumentEx ception { | |
208 | if ( ((value == null) && (equalTo ! = null)) | | ((value != null) & & (equalTo == null)) || ((valu e != null) && !value .equals(eq ualTo))) { | |
209 | fail(a rgument, " an instanc e equal to '" + equa lTo + "'", value); | |
210 | } | |
211 | } | |
212 | ||
213 | /* * | |
214 | * Asserts t hat the gi ven object is assign able from a given Cl ass. | |
215 | * | |
216 | * @param ar gument | |
217 | * The name of the ar gument. | |
218 | * @param va lue | |
219 | * The valu e of the a rgument to check. | |
220 | * @param cl azz | |
221 | * The refe rence Clas s, to whic h value is checked. | |
222 | * @throws I llegalArgu mentExcept ion | |
223 | * if valu e's Class is not ass ignable fr om clazz. | |
224 | * / | |
225 | pu blic stati c void ass ertAssigna bleFrom(St ring argum ent, Objec t value, C lass clazz ) | |
226 | thro ws Illegal ArgumentEx ception { | |
227 | if ( !Assertion Utils.isAs signableFr om(value, clazz)) { | |
228 | fail(a rgument, " a value of " + clazz , ((value != null) ? value.get Class() : "null")); | |
229 | } | |
230 | } | |
231 | ||
232 | /* * | |
233 | * Asserts t hat the gi ven Class is assigna ble from a given Cla ss. | |
234 | * | |
235 | * @param ar gument | |
236 | * The name of the ar gument. | |
237 | * @param va lue | |
238 | * The valu e of the a rgument to check. | |
239 | * @param cl azz | |
240 | * The refe rence Clas s, to whic h value is checked. | |
241 | * @throws I llegalArgu mentExcept ion | |
242 | * if valu e is not a ssignable from clazz . | |
243 | * / | |
244 | pu blic stati c void ass ertAssigna bleFrom(St ring argum ent, Class value, Cl ass clazz) | |
245 | thro ws Illegal ArgumentEx ception { | |
246 | if ( !Assertion Utils.isAs signableFr om(value, clazz)) { | |
247 | fail(a rgument, c lazz, valu e); | |
248 | } | |
249 | } | |
250 | ||
251 | /* * | |
252 | * Asserts t hat the gi ven argume nt is a po sitive num ber. Autob oxing allo ws | |
253 | * to primit ive number s as well. | |
254 | * | |
255 | * @param ar gument | |
256 | * The name of the ar gument. | |
257 | * @param va lue | |
258 | * The valu e of the a rgument to check. | |
259 | * @throws I llegalArgu mentExcept ion | |
260 | * If the value is n ull or not a positiv e number. | |
261 | * / | |
262 | pu blic stati c void ass ertPositiv e(String a rgument, N umber valu e) | |
263 | thro ws Illegal ArgumentEx ception { | |
264 | if ( !Assertion Utils.isPo sitive(val ue)) { | |
265 | fail(a rgument, " a positive number", value); | |
266 | } | |
267 | } | |
268 | ||
269 | /* * | |
270 | * Asserts t hat the gi ven argume nt is a po sitive num ber or 0. Autoboxing | |
271 | * allows to pass prim itive numb ers as wel l. | |
272 | * | |
273 | * @param ar gument | |
274 | * The name of the ar gument. | |
275 | * @param va lue | |
276 | * The valu e of the a rgument to check. | |
277 | * @throws I llegalArgu mentExcept ion | |
278 | * If the value is n ull, not a positive number or 0. | |
279 | * / | |
280 | pu blic stati c void ass ertPositiv eOrZero(St ring argum ent, Numbe r value) | |
281 | thro ws Illegal ArgumentEx ception { | |
282 | if ( !Assertion Utils.isPo sitiveOrZe ro(value)) { | |
283 | fail(a rgument, " a positive number or 0", value ); | |
284 | } | |
285 | } | |
286 | ||
287 | /* * | |
288 | * Asserts t hat the gi ven argume nt is a ne gative num ber. Autob oxing allo ws | |
289 | * to pass p rimitive n umbers as well. | |
290 | * | |
291 | * @param ar gument | |
292 | * The name of the ar gument. | |
293 | * @param va lue | |
294 | * The valu e of the a rgument to check. | |
295 | * @throws I llegalArgu mentExcept ion | |
296 | * If the value is n ull or not a negativ e number. | |
297 | * / | |
298 | pu blic stati c void ass ertNegativ e(String a rgument, N umber valu e) | |
299 | thro ws Illegal ArgumentEx ception { | |
300 | if ( !Assertion Utils.isNe gative(val ue)) { | |
301 | fail(a rgument, " a negative integer", value); | |
302 | } | |
303 | } | |
304 | ||
305 | /* * | |
306 | * Asserts t hat the gi ven argume nt is a ne gative int eger or 0. Autoboxin g | |
307 | * allows to pass prim itive numb er as well . | |
308 | * | |
309 | * @param ar gument | |
310 | * The name of the ar gument. | |
311 | * @param va lue | |
312 | * The valu e of the a rgument to check. | |
313 | * @throws I llegalArgu mentExcept ion | |
314 | * If the value is n ull, not a negative number or 0. | |
315 | * / | |
316 | pu blic stati c void ass ertNegativ eOrZero(St ring argum ent, Numbe r value) | |
317 | thro ws Illegal ArgumentEx ception { | |
318 | if ( !Assertion Utils.isNe gativeOrZe ro(value)) { | |
319 | fail(a rgument, " a negative integer o r 0", valu e); | |
320 | } | |
321 | } | |
322 | ||
323 | /* * | |
324 | * Asserts t hat the gi ven number value lie s between an lower a nd an uppe r | |
325 | * bound val ue. | |
326 | * | |
327 | * @param ar gument | |
328 | * The name of the ar gument to check | |
329 | * @param va lue | |
330 | * The valu e to check | |
331 | * @param lo werBound | |
332 | * The lowe rbound val ue. Value must be > lowerBound . If | |
333 | * lowerbou nd is null , negative infinity is assumed . | |
334 | * @param up perBound | |
335 | * The uppe rbound val ue. Value must be < upperBound . If | |
336 | * upperbou nd is null , infinity is assume d. | |
337 | * @throws I llegalArgu mentExcept ion | |
338 | * When th e value > 0 | |
339 | * / | |
340 | pu blic stati c void ass ertBetween (String ar gument, Nu mber value , Number l owerBound, Number up perBound) { | |
341 | if ( !Assertion Utils.isBe tween(valu e, lowerBo und, upper Bound)) { | |
342 | fail(a rgument, " a value be tween " + ((lowerBou nd != null ) ? lowerB ound.toStr ing() : "n egative in finity") + " and " + | |
343 | ((upperB ound != nu ll) ? uppe rBound.toS tring() : "(positive ) infinity "), value) ; | |
344 | } | |
345 | } | |
346 | ||
347 | /* * | |
348 | * Asserts t hat the gi ven argume nt is befo re a given date. | |
349 | * | |
350 | * @param ar gument | |
351 | * The name of the ar gument to validate | |
352 | * @param va lue | |
353 | * The valu e of the a rgument to validate | |
354 | * @param be fore | |
355 | * The date which mus t be prece ded by val ue. | |
356 | * @throws I llegalArgu mentExcept ion | |
357 | * When th e value is not a dat e that pre cedes the given befo re | |
358 | * date. | |
359 | * / | |
360 | pu blic stati c void ass ertBefore( String arg ument, Dat e value, D ate before ) { | |
361 | if ( AssertionU tils.isBef ore(value, before)) { | |
362 | fail(a rgument, " a date bef ore " + be fore, valu e); | |
363 | } | |
364 | } | |
365 | ||
366 | /* * | |
367 | * Asserts t hat the gi ven argume nt is befo re or on a given dat e. | |
368 | * | |
369 | * @param ar gument | |
370 | * The name of the ar gument to check | |
371 | * @param va lue | |
372 | * The valu e of the a rgument to check | |
373 | * @param be foreorEqua l | |
374 | * The date which mus t be prece ded by val ue or valu e must be on | |
375 | * this dat e | |
376 | * @throws I llegalArgu mentExcept ion | |
377 | * When th e value is not a dat e that pre cedes or i s on the g iven | |
378 | * beforeO rEqual dat e. | |
379 | * / | |
380 | pu blic stati c void ass ertBeforeO rOn(String argument, Date valu e, Date be foreOrOn) { | |
381 | if ( AssertionU tils.isBef oreOrOn(va lue, befor eOrOn)) { | |
382 | fail(a rgument, " a date bef ore or on " + before OrOn, valu e); | |
383 | } | |
384 | } | |
385 | ||
386 | /* * | |
387 | * Asserts t hat the gi ven argume nt is afte r a given date. | |
388 | * | |
389 | * @param ar gument | |
390 | * The name of the ar gument to validate | |
391 | * @param va lue | |
392 | * The valu e of the a rgument to validate | |
393 | * @param af ter | |
394 | * The date which mus t be prece ded by val ue. | |
395 | * @throws I llegalArgu mentExcept ion | |
396 | * When th e value is not a dat e that pre cedes the given afte r | |
397 | * date. | |
398 | * / | |
399 | pu blic stati c void ass ertAfter(S tring argu ment, Date value, Da te after) | |
400 | thro ws Illegal ArgumentEx ception { | |
401 | if ( AssertionU tils.isAft er(value, after)) { | |
402 | fail(a rgument, " a date aft er " + aft er, value) ; | |
403 | } | |
404 | } | |
405 | ||
406 | /* * | |
407 | * Asserts t hat the gi ven argume nt is Afte r or on a given date . | |
408 | * | |
409 | * @param ar gument | |
410 | * The name of the ar gument to check | |
411 | * @param va lue | |
412 | * The valu e of the a rgument to check | |
413 | * @param Af terorEqual | |
414 | * The date which mus t be prece ded by val ue or valu e must be on | |
415 | * this dat e | |
416 | * @throws I llegalArgu mentExcept ion | |
417 | * When th e value is not a dat e that pre cedes or i s on the g iven | |
418 | * afterOr Equal date . When eit her the va lue or the afterOrEq ual | |
419 | * date is null no e xception i s thrown. | |
420 | * / | |
421 | pu blic stati c void ass ertAfterOr On(String argument, Date value , Date aft erOrOn) | |
422 | thro ws Illegal ArgumentEx ception { | |
423 | if ( AssertionU tils.isAft erOrOn(val ue, afterO rOn)) { | |
424 | fail(a rgument, " a date aft er or on " + afterOr On, value) ; | |
425 | } | |
426 | } | |
427 | ||
428 | /* * | |
429 | * Asserts t hat the gi ven argume nt is not null and i ts element s are not | |
430 | * null. | |
431 | * | |
432 | * @param na me | |
433 | * The name of the ar gument to check. | |
434 | * @param va lues | |
435 | * The valu e of the a rgument to check. | |
436 | * @throws I llegalArgu mentExcept ion | |
437 | * When th e value is null or i ts element s are null . | |
438 | * / | |
439 | pu blic stati c void ass ertNotNull (String na me, Object [] values) { | |
440 | asse rtNotNull( name, (Obj ect) value s); | |
441 | fina l int LENG TH = value s.length; | |
442 | for (int i = 0 ; i < LENG TH; i++) { | |
443 | if (va lues[i] == null) { | |
444 | fail(nam e, "Expect ed a non-n ull value for " + i + "-th ele ment", val ues); | |
445 | } | |
446 | } | |
447 | } | |
448 | ||
449 | /* * | |
450 | * Asserts t hat the gi ven collec tion is no t null and its eleme nts are no t | |
451 | * null. | |
452 | * | |
453 | * @param na me | |
454 | * The name of the ar gument to check. | |
455 | * @param va lue | |
456 | * The valu e of the a rgument to check. | |
457 | * @throws I llegalArgu mentExcept ion | |
458 | * When th e collecti on is null or contai n nulls. | |
459 | * / | |
460 | pu blic stati c void ass ertNotNull (String na me, Collec tion value s) | |
461 | thro ws Illegal ArgumentEx ception { | |
462 | asse rtNotNull( name, (Obj ect) value s); | |
463 | int n = 0; | |
464 | for (Iterator i = values .iterator( ); i.hasNe xt(); n++) { | |
465 | if (i. next() == null) { | |
466 | fail(nam e, "Expect ed a non-n ull value for " + n + "-th ele ment", val ues); | |
467 | } | |
468 | } | |
469 | } | |
470 | ||
471 | /* * | |
472 | * Asserts t hat the gi ven collec tion is no t null, it s elements are not n ull | |
473 | * and it co ntains at least one element. | |
474 | * | |
475 | * @param na me | |
476 | * The name of the ar gument to check. | |
477 | * @param va lue | |
478 | * The valu e of the a rgument to check. | |
479 | * @throws I llegalArgu mentExcept ion | |
480 | * When th e collecti on is null , empty or contains nulls. | |
481 | * / | |
482 | pu blic stati c void ass ertNotEmpt y(String n ame, Colle ction valu es) | |
483 | thro ws Illegal ArgumentEx ception { | |
484 | asse rtNotNull( name, valu es); | |
485 | if ( values.siz e() == 0) { | |
486 | fail(n ame, "a no n-empty co llection", "Empty co llection") ; | |
487 | } | |
488 | } | |
489 | ||
490 | /* * | |
491 | * Precondit ion is not statisfie d. | |
492 | * | |
493 | * @param ar gument | |
494 | * The name of the ar gument | |
495 | * @param ex pected | |
496 | * The expe cted value of the ar gument | |
497 | * @param ac tual | |
498 | * The actu al value o f the argu ment. | |
499 | * @throws I llegalArgu mentExcept ion | |
500 | * Always | |
501 | * / | |
502 | pu blic stati c void fai l(String a rgument, O bject expe cted, Obje ct actual) | |
503 | thro ws Illegal ArgumentEx ception { | |
504 | fail (argument, "Expected " + expec ted + ", b ut got " + actual); | |
505 | } | |
506 | ||
507 | /* * | |
508 | * Precondit ion is not statisfie d. | |
509 | * | |
510 | * @param ar gument | |
511 | * The name of the ar gument | |
512 | * @param ex pected | |
513 | * The expe cted value of the ar gument | |
514 | * @param ac tual | |
515 | * The actu al value o f the argu ment. | |
516 | * @throws I llegalArgu mentExcept ion | |
517 | * Always | |
518 | * / | |
519 | pu blic stati c void fai l(String a rgument, O bject expe cted, Obje ct actual, String de scription) | |
520 | thro ws Illegal ArgumentEx ception { | |
521 | fail (argument, "Expected " + expec ted + ", b ut got " + actual + ". " + des cription); | |
522 | } | |
523 | ||
524 | /* * | |
525 | * Precondit ion is not statisfie d. | |
526 | * | |
527 | * @param ar gument | |
528 | * The name of the ar gument | |
529 | * @param de scription | |
530 | * The desc ription of the condi tion that is not met . | |
531 | * @throws I llegalArgu mentExcept ion | |
532 | * Always | |
533 | * / | |
534 | pu blic stati c void fai l(String a rgument, S tring desc ription) | |
535 | thro ws Illegal ArgumentEx ception { | |
536 | thro w new Ille galArgumen tException (((argumen t != null) ? "Argume nt '" + ar gument + " ': " : "") + descrip tion); | |
537 | } | |
538 | ||
539 | /* * | |
540 | * Precondit ion is not statisfie d. | |
541 | * | |
542 | * @param de scription | |
543 | * The desc ription of the condi tion that is not met . | |
544 | * @throws I llegalArgu mentExcept ion | |
545 | * Always | |
546 | * / | |
547 | pu blic stati c void fai l(String d escription ) | |
548 | thro ws Illegal ArgumentEx ception { | |
549 | thro w new Ille galArgumen tException (descripti on); | |
550 | } | |
551 | ||
552 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.