001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003: * Distributed under the terms of either:
004: * - the common development and distribution license (CDDL), v1.0; or
005: * - the GNU Lesser General Public License, v2.1 or later
006: * $Id: TestValidityChecks.java 3634 2007-01-08 21:42:24Z gbevin $
007: */
008: package com.uwyn.rife.site;
009:
010: import java.text.SimpleDateFormat;
011: import java.util.Date;
012:
013: import junit.framework.TestCase;
014:
015: public class TestValidityChecks extends TestCase {
016: public TestValidityChecks(String name) {
017: super (name);
018: }
019:
020: public void testCheckNotNull() {
021: assertFalse(ValidityChecks.checkNotNull(null));
022: assertTrue(ValidityChecks.checkNotNull(new Object()));
023: }
024:
025: public void testCheckNotEmptyCharSequence() {
026: assertTrue(ValidityChecks.checkNotEmpty((CharSequence) null));
027: assertTrue(ValidityChecks.checkNotEmpty("ok"));
028: assertFalse(ValidityChecks.checkNotEmpty(""));
029: }
030:
031: public void testCheckNotEmptyCharacterObject() {
032: assertTrue(ValidityChecks.checkNotEmpty((Character) null));
033: assertTrue(ValidityChecks.checkNotEmpty(new Character('I')));
034: assertFalse(ValidityChecks
035: .checkNotEmpty(new Character((char) 0)));
036: }
037:
038: public void testCheckNotEmptyChar() {
039: assertTrue(ValidityChecks.checkNotEmpty('K'));
040: assertFalse(ValidityChecks.checkNotEmpty((char) 0));
041: }
042:
043: public void testCheckNotEmptyByteObject() {
044: assertTrue(ValidityChecks.checkNotEmpty((Byte) null));
045: assertTrue(ValidityChecks.checkNotEmpty(new Byte((byte) 87)));
046: assertFalse(ValidityChecks.checkNotEmpty(new Byte((byte) 0)));
047: }
048:
049: public void testCheckNotEmptyByte() {
050: assertTrue(ValidityChecks.checkNotEmpty((byte) 98));
051: assertFalse(ValidityChecks.checkNotEmpty((byte) 0));
052: }
053:
054: public void testCheckNotEmptyShortObject() {
055: assertTrue(ValidityChecks.checkNotEmpty((Short) null));
056: assertTrue(ValidityChecks.checkNotEmpty(new Short((short) 223)));
057: assertFalse(ValidityChecks.checkNotEmpty(new Short((short) 0)));
058: }
059:
060: public void testCheckNotEmptyShort() {
061: assertTrue(ValidityChecks.checkNotEmpty((short) 8982));
062: assertFalse(ValidityChecks.checkNotEmpty((short) 0));
063: }
064:
065: public void testCheckNotEmptyIntegerObject() {
066: assertTrue(ValidityChecks.checkNotEmpty((Integer) null));
067: assertTrue(ValidityChecks.checkNotEmpty(new Integer(8796)));
068: assertFalse(ValidityChecks.checkNotEmpty(new Integer(0)));
069: }
070:
071: public void testCheckNotEmptyInteger() {
072: assertTrue(ValidityChecks.checkNotEmpty(622));
073: assertFalse(ValidityChecks.checkNotEmpty(0));
074: }
075:
076: public void testCheckNotEmptyLongObject() {
077: assertTrue(ValidityChecks.checkNotEmpty((Long) null));
078: assertTrue(ValidityChecks.checkNotEmpty(new Long(6887232L)));
079: assertFalse(ValidityChecks.checkNotEmpty(new Long(0L)));
080: }
081:
082: public void testCheckNotEmptyLong() {
083: assertTrue(ValidityChecks.checkNotEmpty(2324338L));
084: assertFalse(ValidityChecks.checkNotEmpty(0L));
085: }
086:
087: public void testCheckNotEmptyFloatObject() {
088: assertTrue(ValidityChecks.checkNotEmpty((Float) null));
089: assertTrue(ValidityChecks.checkNotEmpty(new Float(923.78f)));
090: assertFalse(ValidityChecks.checkNotEmpty(new Float(0.0f)));
091: }
092:
093: public void testCheckNotEmptyFloat() {
094: assertTrue(ValidityChecks.checkNotEmpty(234.98f));
095: assertFalse(ValidityChecks.checkNotEmpty(0.0f));
096: }
097:
098: public void testCheckNotEmptyDoubleObject() {
099: assertTrue(ValidityChecks.checkNotEmpty((Double) null));
100: assertTrue(ValidityChecks.checkNotEmpty(new Double(98023.343d)));
101: assertFalse(ValidityChecks.checkNotEmpty(new Double(0.0d)));
102: }
103:
104: public void testCheckNotEmptyDouble() {
105: assertTrue(ValidityChecks.checkNotEmpty(8723.87901d));
106: assertFalse(ValidityChecks.checkNotEmpty(0.0d));
107: }
108:
109: public void testCheckNotEmptyObject() {
110: assertTrue(ValidityChecks.checkNotEmpty((Object) null));
111: assertTrue(ValidityChecks.checkNotEmpty((Object) "ok"));
112: assertFalse(ValidityChecks.checkNotEmpty((Object) ""));
113: assertTrue(ValidityChecks.checkNotEmpty((Object) new Character(
114: 'I')));
115: assertFalse(ValidityChecks
116: .checkNotEmpty((Object) new Character((char) 0)));
117: assertTrue(ValidityChecks.checkNotEmpty((Object) new Byte(
118: (byte) 87)));
119: assertFalse(ValidityChecks.checkNotEmpty((Object) new Byte(
120: (byte) 0)));
121: assertTrue(ValidityChecks.checkNotEmpty((Object) new Short(
122: (short) 223)));
123: assertFalse(ValidityChecks.checkNotEmpty((Object) new Short(
124: (short) 0)));
125: assertTrue(ValidityChecks.checkNotEmpty((Object) new Integer(
126: 8796)));
127: assertFalse(ValidityChecks
128: .checkNotEmpty((Object) new Integer(0)));
129: assertTrue(ValidityChecks.checkNotEmpty((Object) new Long(
130: 6887232L)));
131: assertFalse(ValidityChecks.checkNotEmpty((Object) new Long(0L)));
132: assertTrue(ValidityChecks.checkNotEmpty((Object) new Float(
133: 923.78f)));
134: assertFalse(ValidityChecks.checkNotEmpty((Object) new Float(
135: 0.0f)));
136: assertTrue(ValidityChecks.checkNotEmpty((Object) new Double(
137: 98023.343d)));
138: assertFalse(ValidityChecks.checkNotEmpty((Object) new Double(
139: 0.0d)));
140: assertTrue(ValidityChecks.checkNotEmpty((Object) new String[] {
141: "one", "two", "three" }));
142: assertFalse(ValidityChecks.checkNotEmpty((Object) new String[] {
143: "one", "two", " " }));
144: assertTrue(ValidityChecks.checkNotEmpty((Object) new int[] {
145: 34, 9, 34 }));
146: assertFalse(ValidityChecks.checkNotEmpty((Object) new int[] {
147: 4, 0, 9 }));
148:
149: assertTrue(ValidityChecks.checkNotEmpty(new Date()));
150: }
151:
152: public void testCheckNotEqualBoolean() {
153: assertTrue(ValidityChecks.checkNotEqual(true, false));
154: assertFalse(ValidityChecks.checkNotEqual(true, true));
155: }
156:
157: public void testCheckNotEqualChar() {
158: assertTrue(ValidityChecks.checkNotEqual('K', 'L'));
159: assertFalse(ValidityChecks.checkNotEqual('a', 'a'));
160: }
161:
162: public void testCheckNotEqualByte() {
163: assertTrue(ValidityChecks.checkNotEqual((byte) 98, (byte) 76));
164: assertFalse(ValidityChecks.checkNotEqual((byte) 17, (byte) 17));
165: }
166:
167: public void testCheckNotEqualShort() {
168: assertTrue(ValidityChecks.checkNotEqual((short) 8982,
169: (short) 237));
170: assertFalse(ValidityChecks
171: .checkNotEqual((short) 23, (short) 23));
172: }
173:
174: public void testCheckNotEqualInteger() {
175: assertTrue(ValidityChecks.checkNotEqual(622, 766));
176: assertFalse(ValidityChecks.checkNotEqual(234, 234));
177: }
178:
179: public void testCheckNotEqualLong() {
180: assertTrue(ValidityChecks.checkNotEqual(2324338L, 343876L));
181: assertFalse(ValidityChecks.checkNotEqual(343224L, 343224L));
182: }
183:
184: public void testCheckNotEqualFloat() {
185: assertTrue(ValidityChecks.checkNotEqual(234.98f, 3487.22f));
186: assertFalse(ValidityChecks.checkNotEqual(433.2f, 433.2f));
187: }
188:
189: public void testCheckNotEqualDouble() {
190: assertTrue(ValidityChecks.checkNotEqual(8723.87901d,
191: 34786783.232d));
192: assertFalse(ValidityChecks.checkNotEqual(52982.2322d,
193: 52982.2322d));
194: }
195:
196: public void testCheckNotEqualObject() {
197: assertTrue(ValidityChecks.checkNotEqual(null, null));
198: assertTrue(ValidityChecks.checkNotEqual(new Object(), null));
199: assertTrue(ValidityChecks.checkNotEqual(null, new Object()));
200: assertTrue(ValidityChecks.checkNotEqual("test", "test2"));
201: assertFalse(ValidityChecks.checkNotEqual("test3", "test3"));
202: }
203:
204: public void testCheckNotEqualArray() {
205: assertTrue(ValidityChecks.checkNotEqual((String[]) null,
206: (String[]) null));
207: assertTrue(ValidityChecks.checkNotEqual(new String[] { "one" },
208: null));
209: assertTrue(ValidityChecks.checkNotEqual(new String[] { "test",
210: "test2", "test3" }, "test4"));
211: assertFalse(ValidityChecks.checkNotEqual(new String[] { "test",
212: "test2", "test3" }, "test3"));
213: assertTrue(ValidityChecks.checkNotEqual(new int[] { 89, 8, 5 },
214: 3));
215: assertFalse(ValidityChecks.checkNotEqual(
216: new int[] { 89, 8, 3 }, 3));
217: }
218:
219: public void testCheckEqualBoolean() {
220: assertFalse(ValidityChecks.checkEqual(true, false));
221: assertTrue(ValidityChecks.checkEqual(true, true));
222: }
223:
224: public void testCheckEqualChar() {
225: assertFalse(ValidityChecks.checkEqual('K', 'L'));
226: assertTrue(ValidityChecks.checkEqual('a', 'a'));
227: }
228:
229: public void testCheckEqualByte() {
230: assertFalse(ValidityChecks.checkEqual((byte) 98, (byte) 76));
231: assertTrue(ValidityChecks.checkEqual((byte) 17, (byte) 17));
232: }
233:
234: public void testCheckEqualShort() {
235: assertFalse(ValidityChecks
236: .checkEqual((short) 8982, (short) 237));
237: assertTrue(ValidityChecks.checkEqual((short) 23, (short) 23));
238: }
239:
240: public void testCheckEqualInteger() {
241: assertFalse(ValidityChecks.checkEqual(622, 766));
242: assertTrue(ValidityChecks.checkEqual(234, 234));
243: }
244:
245: public void testCheckEqualLong() {
246: assertFalse(ValidityChecks.checkEqual(2324338L, 343876L));
247: assertTrue(ValidityChecks.checkEqual(343224L, 343224L));
248: }
249:
250: public void testCheckEqualFloat() {
251: assertFalse(ValidityChecks.checkEqual(234.98f, 3487.22f));
252: assertTrue(ValidityChecks.checkEqual(433.2f, 433.2f));
253: }
254:
255: public void testCheckEqualDouble() {
256: assertFalse(ValidityChecks.checkEqual(8723.87901d,
257: 34786783.232d));
258: assertTrue(ValidityChecks.checkEqual(52982.2322d, 52982.2322d));
259: }
260:
261: public void testCheckEqualObject() {
262: assertTrue(ValidityChecks.checkEqual(null, null));
263: assertTrue(ValidityChecks.checkEqual(new Object(), null));
264: assertTrue(ValidityChecks.checkEqual(null, new Object()));
265: assertFalse(ValidityChecks.checkEqual("test", "test2"));
266: assertTrue(ValidityChecks.checkEqual("test3", "test3"));
267: }
268:
269: public void testCheckEqualArray() {
270: assertTrue(ValidityChecks.checkEqual((String[]) null,
271: (String[]) null));
272: assertTrue(ValidityChecks.checkEqual(new String[] { "one" },
273: null));
274: assertTrue(ValidityChecks.checkEqual(new String[] { "test3",
275: "test3", "test3" }, "test3"));
276: assertFalse(ValidityChecks.checkEqual(new String[] { "test3",
277: "test3", "test2" }, "test3"));
278: assertTrue(ValidityChecks.checkEqual(new int[] { 5, 5, 5 }, 5));
279: assertFalse(ValidityChecks.checkEqual(new int[] { 5, 5, 3 }, 5));
280: }
281:
282: public void testCheckLengthByte() {
283: assertTrue(ValidityChecks.checkLength((byte) 23, 0, 2));
284: assertFalse(ValidityChecks.checkLength((byte) 120, 0, 2));
285: assertFalse(ValidityChecks.checkLength((byte) 2, 2, 3));
286: }
287:
288: public void testCheckLengthChar() {
289: assertTrue(ValidityChecks.checkLength('O', 0, 2));
290: assertTrue(ValidityChecks.checkLength('K', 1, 2));
291: assertFalse(ValidityChecks.checkLength('f', 2, 3));
292: }
293:
294: public void testCheckLengthShort() {
295: assertTrue(ValidityChecks.checkLength((short) 2341, 0, 4));
296: assertFalse(ValidityChecks.checkLength((short) 23419, 0, 4));
297: assertFalse(ValidityChecks.checkLength((short) 143, 4, 7));
298: }
299:
300: public void testCheckLengthInt() {
301: assertTrue(ValidityChecks.checkLength(2341, 0, 4));
302: assertFalse(ValidityChecks.checkLength(23419, 0, 4));
303: assertFalse(ValidityChecks.checkLength(143, 4, 7));
304: }
305:
306: public void testCheckLengthLong() {
307: assertTrue(ValidityChecks.checkLength(2341L, 0, 4));
308: assertFalse(ValidityChecks.checkLength(23419L, 0, 4));
309: assertFalse(ValidityChecks.checkLength(143L, 4, 7));
310: }
311:
312: public void testCheckLengthFloat() {
313: assertTrue(ValidityChecks.checkLength(21.78f, 0, 5));
314: assertFalse(ValidityChecks.checkLength(231.78f, 0, 5));
315: assertFalse(ValidityChecks.checkLength(12.8f, 5, 7));
316: }
317:
318: public void testCheckLengthDouble() {
319: assertTrue(ValidityChecks.checkLength(21.78d, 0, 5));
320: assertFalse(ValidityChecks.checkLength(231.78d, 0, 5));
321: assertFalse(ValidityChecks.checkLength(12.8d, 5, 7));
322: }
323:
324: public void testCheckLength() {
325: assertTrue(ValidityChecks.checkLength(null, 0, 0));
326:
327: StringBuffer string = new StringBuffer("testing");
328: assertTrue(ValidityChecks.checkLength(string, 0, 7));
329: assertTrue(ValidityChecks.checkLength(string, 5, 7));
330: assertFalse(ValidityChecks.checkLength(string, 8, 10));
331: assertFalse(ValidityChecks.checkLength(string, 0, 6));
332: assertTrue(ValidityChecks.checkLength(string, -10, -20));
333: }
334:
335: public void testCheckRegexp() {
336: assertTrue(ValidityChecks.checkRegexp(null, null));
337: assertTrue(ValidityChecks.checkRegexp(null, ""));
338: assertTrue(ValidityChecks.checkRegexp(null, "\\d+"));
339: assertTrue(ValidityChecks.checkRegexp("", "\\d+"));
340: assertTrue(ValidityChecks.checkRegexp(new Integer(2343)
341: .toString(), "\\d+"));
342: assertFalse(ValidityChecks.checkRegexp("jhiuh", "\\d+"));
343: assertFalse(ValidityChecks.checkRegexp(new Integer(2343)
344: .toString(), "\\d{4,"));
345: }
346:
347: public void testCheckEmail() {
348: assertTrue(ValidityChecks.checkEmail("john.doe@something.com"));
349: assertTrue(ValidityChecks.checkEmail("john+doe@something.com"));
350: assertFalse(ValidityChecks.checkEmail("john.doe@something."));
351: }
352:
353: public void testCheckUrl() {
354: assertTrue(ValidityChecks.checkUrl(null));
355: assertTrue(ValidityChecks.checkUrl(""));
356: assertTrue(ValidityChecks.checkUrl("http://uwyn.com"));
357: assertTrue(ValidityChecks.checkUrl("https://www.uwyn.com"));
358: assertFalse(ValidityChecks.checkUrl("htt:uwyn"));
359: }
360:
361: public void testLaterThanNow() {
362: assertTrue(ValidityChecks.checkLaterThanNow(null));
363: assertTrue(ValidityChecks
364: .checkLaterThanNow(new Date(2003, 3, 1)));
365: }
366:
367: public void testLimitedDate() {
368: assertTrue(ValidityChecks.checkLimitedDate(null, null, null));
369: assertTrue(ValidityChecks.checkLimitedDate("test", null, null));
370: assertTrue(ValidityChecks.checkLimitedDate(new Date(2003, 12,
371: 11), null, null));
372: assertTrue(ValidityChecks.checkLimitedDate(new Date(2003, 12,
373: 11), new Date(2003, 3, 1), new Date(2004, 3, 1)));
374: assertFalse(ValidityChecks.checkLimitedDate(new Date(2003, 12,
375: 11), new Date(2004, 3, 1), null));
376: assertFalse(ValidityChecks.checkLimitedDate(new Date(2003, 12,
377: 11), null, new Date(2003, 11, 1)));
378: assertFalse(ValidityChecks.checkLimitedDate(new Date(2003, 12,
379: 11), new Date(2004, 3, 1), new Date(2004, 4, 1)));
380: assertFalse(ValidityChecks.checkLimitedDate(new Date(2003, 12,
381: 11), new Date(2003, 3, 1), new Date(2003, 4, 1)));
382: }
383:
384: public void testInList() {
385: assertTrue(ValidityChecks.checkInList(null, null));
386: assertTrue(ValidityChecks.checkInList(null, new String[0]));
387: assertTrue(ValidityChecks.checkInList("test", new String[0]));
388: assertTrue(ValidityChecks.checkInList("test", null));
389: assertTrue(ValidityChecks.checkInList("test", new String[] {
390: "one", "two", "test", "aaa" }));
391: assertTrue(ValidityChecks.checkInList("", new String[] { "in",
392: "ok" }));
393: assertTrue(ValidityChecks.checkInList(new String[0],
394: new String[] { "in", "ok" }));
395: assertTrue(ValidityChecks.checkInList(new String[] { "test",
396: "one" }, new String[] { "one", "two", "test", "aaa" }));
397: assertFalse(ValidityChecks
398: .checkInList(new String[] { "test", "three" },
399: new String[] { "one", "two", "test", "aaa" }));
400: assertTrue(ValidityChecks.checkInList(new int[] { 98, 17, 3 },
401: new String[] { "3", "98", "4", "17" }));
402: assertFalse(ValidityChecks.checkInList(
403: new int[] { 1, 98, 17, 3 }, new String[] { "3", "98",
404: "4", "17" }));
405: }
406:
407: public void testCheckRangeByte() {
408: assertTrue(ValidityChecks.checkRange((byte) 0, (byte) 0,
409: (byte) 23));
410: assertTrue(ValidityChecks.checkRange((byte) 12, (byte) 0,
411: (byte) 23));
412: assertTrue(ValidityChecks.checkRange((byte) 23, (byte) 7,
413: (byte) 23));
414: assertFalse(ValidityChecks.checkRange((byte) 24, (byte) 7,
415: (byte) 23));
416: assertFalse(ValidityChecks.checkRange((byte) 6, (byte) 7,
417: (byte) 23));
418: }
419:
420: public void testCheckRangeChar() {
421: assertTrue(ValidityChecks.checkRange('b', 'b', 'y'));
422: assertTrue(ValidityChecks.checkRange('g', 'b', 'y'));
423: assertTrue(ValidityChecks.checkRange('y', 'b', 'y'));
424: assertFalse(ValidityChecks.checkRange('a', 'b', 'y'));
425: assertFalse(ValidityChecks.checkRange('z', 'b', 'y'));
426: }
427:
428: public void testCheckRangeShort() {
429: assertTrue(ValidityChecks.checkRange((short) 0, (short) 0,
430: (short) 23));
431: assertTrue(ValidityChecks.checkRange((short) 8, (short) 0,
432: (short) 23));
433: assertTrue(ValidityChecks.checkRange((short) 23, (short) 7,
434: (short) 23));
435: assertFalse(ValidityChecks.checkRange((short) 24, (short) 7,
436: (short) 23));
437: assertFalse(ValidityChecks.checkRange((short) 6, (short) 7,
438: (short) 23));
439: }
440:
441: public void testCheckRangeInt() {
442: assertTrue(ValidityChecks.checkRange(0, 0, 23));
443: assertTrue(ValidityChecks.checkRange(9, 0, 23));
444: assertTrue(ValidityChecks.checkRange(23, 7, 23));
445: assertFalse(ValidityChecks.checkRange(24, 7, 23));
446: assertFalse(ValidityChecks.checkRange(6, 7, 23));
447: }
448:
449: public void testCheckRangeLong() {
450: assertTrue(ValidityChecks.checkRange(0L, 0, 23));
451: assertTrue(ValidityChecks.checkRange(12L, 0, 23));
452: assertTrue(ValidityChecks.checkRange(23L, 7, 23));
453: assertFalse(ValidityChecks.checkRange(24L, 7, 23));
454: assertFalse(ValidityChecks.checkRange(6L, 7, 23));
455: }
456:
457: public void testCheckRangeFloat() {
458: assertTrue(ValidityChecks.checkRange(0.7f, 0.7f, 23.9f));
459: assertTrue(ValidityChecks.checkRange(15.9f, 0.7f, 23.9f));
460: assertTrue(ValidityChecks.checkRange(23.9f, 0.7f, 23.9f));
461: assertFalse(ValidityChecks.checkRange(0.699f, 0.7f, 23.9f));
462: assertFalse(ValidityChecks.checkRange(23.901f, 0.7f, 23.9f));
463: }
464:
465: public void testCheckRangeDouble() {
466: assertTrue(ValidityChecks.checkRange(0.7d, 0.7d, 23.9d));
467: assertTrue(ValidityChecks.checkRange(19.23d, 0.7d, 23.9d));
468: assertTrue(ValidityChecks.checkRange(23.9d, 0.7d, 23.9d));
469: assertFalse(ValidityChecks.checkRange(0.699d, 0.7d, 23.9d));
470: assertFalse(ValidityChecks.checkRange(23.901d, 0.7d, 23.9d));
471: }
472:
473: public void testCheckRangeObject() {
474: assertTrue(ValidityChecks.checkRange(null, "abc", "zrr"));
475: assertTrue(ValidityChecks
476: .checkRange(new Object(), "aaa", "aaa"));
477: assertTrue(ValidityChecks.checkRange("bgt", null, null));
478: assertTrue(ValidityChecks.checkRange("abc", "abc", "zrr"));
479: assertTrue(ValidityChecks.checkRange("bgt", "abc", "zrr"));
480: assertTrue(ValidityChecks.checkRange("zrr", "abc", "zrr"));
481: assertFalse(ValidityChecks.checkRange("abb", "abc", "zrr"));
482: assertFalse(ValidityChecks.checkRange("zrs", "abc", "zrr"));
483: }
484:
485: public void testCheckRangeArray() {
486: assertTrue(ValidityChecks.checkRange(new String[] { "abc",
487: "ccc", "zrr" }, "abc", "zrr"));
488: assertFalse(ValidityChecks.checkRange(new String[] { "abb",
489: "ccc", "zrr" }, "abc", "zrr"));
490: assertTrue(ValidityChecks.checkRange(new int[] { 89, 7, 3 }, 3,
491: 89));
492: assertFalse(ValidityChecks.checkRange(new int[] { 89, 7, 3 },
493: 4, 89));
494: }
495:
496: public void testCheckFormat() {
497: assertTrue(ValidityChecks.checkFormat(null, null));
498: assertTrue(ValidityChecks.checkFormat(new Object(), null));
499: assertTrue(ValidityChecks.checkFormat(new Object(),
500: new SimpleDateFormat("dd/MM/yyyy")));
501: assertTrue(ValidityChecks.checkFormat("testing", null));
502: assertTrue(ValidityChecks.checkFormat("20/02/2004",
503: new SimpleDateFormat("dd/MM/yyyy")));
504: assertFalse(ValidityChecks.checkFormat("2/2/2004",
505: new SimpleDateFormat("dd/MM/yyyy")));
506: assertFalse(ValidityChecks.checkFormat("31/02/2004",
507: new SimpleDateFormat("dd/MM/yyyy")));
508: assertFalse(ValidityChecks.checkFormat("testing",
509: new SimpleDateFormat("dd/MM/yyyy")));
510: }
511: }
|