1- /**
2- * Copyright 2003-2004 The Apache Software Foundation
1+ /*
2+ * Copyright 2003-2005 The Apache Software Foundation
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2828import junit .framework .TestSuite ;
2929
3030/**
31+ * JUnit test case for DateValidator.
32+ *
3133 * @author Rob Oxspring
3234 * @author John Keyes
3335 */
@@ -123,6 +125,8 @@ public void testMinimumBounds() throws InvalidArgumentException {
123125 cal .set (2002 , 1 , 12 );
124126 final Date min = cal .getTime ();
125127 validator .setMinimum (min );
128+ assertTrue ("maximum bound is set" , validator .getMaximum () == null );
129+ assertEquals ("minimum bound is incorrect" , min , validator .getMinimum ());
126130 validator .validate (list );
127131 }
128132
@@ -143,6 +147,11 @@ public void testMinimumBounds() throws InvalidArgumentException {
143147 }
144148 }
145149
150+ public void testFormats () throws InvalidArgumentException {
151+ final DateValidator validator = new DateValidator (formats );
152+ assertEquals ("date formats are incorrect" , formats , validator .getFormats ());
153+ }
154+
146155 public void testMaximumBounds () throws InvalidArgumentException {
147156 final DateValidator validator = new DateValidator (formats );
148157 final Calendar cal = Calendar .getInstance ();
@@ -153,6 +162,8 @@ public void testMaximumBounds() throws InvalidArgumentException {
153162 cal .set (2004 , 1 , 12 );
154163 final Date max = cal .getTime ();
155164 validator .setMaximum (max );
165+ assertTrue ("minimum bound is set" , validator .getMinimum () == null );
166+ assertEquals ("maximum bound is incorrect" , max , validator .getMaximum ());
156167 validator .validate (list );
157168 }
158169
0 commit comments