commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jke...@apache.org
Subject svn commit: r278635 - in /jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation: DateValidatorTest.java FileValidatorTest.java
Date Sun, 04 Sep 2005 22:15:20 GMT
Author: jkeyes
Date: Sun Sep  4 15:15:11 2005
New Revision: 278635

URL: http://svn.apache.org/viewcvs?rev=278635&view=rev
Log:
- added tests

Modified:
    jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/DateValidatorTest.java
    jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/FileValidatorTest.java

Modified: jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/DateValidatorTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/DateValidatorTest.java?rev=278635&r1=278634&r2=278635&view=diff
==============================================================================
--- jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/DateValidatorTest.java
(original)
+++ jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/DateValidatorTest.java
Sun Sep  4 15:15:11 2005
@@ -1,5 +1,5 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
+/*
+ * Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,6 +28,8 @@
 import junit.framework.TestSuite;
 
 /**
+ * JUnit test case for DateValidator.
+ *
  * @author Rob Oxspring
  * @author John Keyes
  */
@@ -123,6 +125,8 @@
             cal.set(2002, 1, 12);
             final Date min = cal.getTime();
             validator.setMinimum(min);
+            assertTrue("maximum bound is set", validator.getMaximum() == null);
+            assertEquals("minimum bound is incorrect", min, validator.getMinimum());
             validator.validate(list);
         }
 
@@ -143,6 +147,11 @@
         }
     }
 
+    public void testFormats() throws InvalidArgumentException {
+        final DateValidator validator = new DateValidator(formats);
+        assertEquals("date formats are incorrect", formats, validator.getFormats());
+    }
+
     public void testMaximumBounds() throws InvalidArgumentException {
         final DateValidator validator = new DateValidator(formats);
         final Calendar cal = Calendar.getInstance();
@@ -153,6 +162,8 @@
             cal.set(2004, 1, 12);
             final Date max = cal.getTime();
             validator.setMaximum(max);
+            assertTrue("minimum bound is set", validator.getMinimum() == null);
+            assertEquals("maximum bound is incorrect", max, validator.getMaximum());
             validator.validate(list);
         }
 

Modified: jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/FileValidatorTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/FileValidatorTest.java?rev=278635&r1=278634&r2=278635&view=diff
==============================================================================
--- jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/FileValidatorTest.java
(original)
+++ jakarta/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/validation/FileValidatorTest.java
Sun Sep  4 15:15:11 2005
@@ -95,8 +95,8 @@
         assertTrue("is a file validator", validator.isFile());
         assertTrue("is an existing file validator", validator.isExisting());
         assertFalse("is not a hidden file validator", validator.isHidden());
-        assertTrue("is not a readable file validator", validator.isReadable());
-        assertFalse("is a writable file validator", validator.isWritable());
+        assertFalse("is not a readable file validator", validator.isReadable());
+        assertTrue("is a writable file validator", validator.isWritable());
 
         try{
             validator.validate(list);



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message