You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/08/01 02:12:32 UTC
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang/time DateUtilsTest.java StopWatchTest.java DateFormatUtilsTest.java DurationFormatUtilsTest.java
scolebourne 2003/07/31 17:12:32
Modified: lang/src/test/org/apache/commons/lang/time
DateUtilsTest.java StopWatchTest.java
DateFormatUtilsTest.java
DurationFormatUtilsTest.java
Log:
Extra tests suggested by Clover
Revision Changes Path
1.5 +12 -2 jakarta-commons/lang/src/test/org/apache/commons/lang/time/DateUtilsTest.java
Index: DateUtilsTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/time/DateUtilsTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DateUtilsTest.java 23 Jun 2003 23:41:10 -0000 1.4
+++ DateUtilsTest.java 1 Aug 2003 00:12:32 -0000 1.5
@@ -53,6 +53,8 @@
*/
package org.apache.commons.lang.time;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -105,8 +107,16 @@
}
//-----------------------------------------------------------------------
-
-
+ public void testConstructor() {
+ assertNotNull(new DateUtils());
+ Constructor[] cons = DateUtils.class.getDeclaredConstructors();
+ assertEquals(1, cons.length);
+ assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
+ assertEquals(true, Modifier.isPublic(DateUtils.class.getModifiers()));
+ assertEquals(false, Modifier.isFinal(DateUtils.class.getModifiers()));
+ }
+
+ //-----------------------------------------------------------------------
/**
* Tests various values with the round method
*/
1.5 +12 -3 jakarta-commons/lang/src/test/org/apache/commons/lang/time/StopWatchTest.java
Index: StopWatchTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/time/StopWatchTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StopWatchTest.java 24 Jun 2003 21:13:55 -0000 1.4
+++ StopWatchTest.java 1 Aug 2003 00:12:32 -0000 1.5
@@ -80,10 +80,9 @@
super(s);
}
+ //-----------------------------------------------------------------------
public void testStopWatchSimple(){
StopWatch watch = new StopWatch();
- assertEquals(0, watch.getTime());
-
watch.start();
try {Thread.sleep(550);} catch (InterruptedException ex) {}
watch.stop();
@@ -95,6 +94,16 @@
watch.reset();
assertEquals(0, watch.getTime());
+ }
+
+ public void testStopWatchSimpleGet(){
+ StopWatch watch = new StopWatch();
+ assertEquals(0, watch.getTime());
+ assertEquals("0:00:00.000", watch.toString());
+
+ watch.start();
+ try {Thread.sleep(500);} catch (InterruptedException ex) {}
+ assertTrue(watch.getTime() < 2000);
}
public void testStopWatchSplit(){
1.2 +13 -0 jakarta-commons/lang/src/test/org/apache/commons/lang/time/DateFormatUtilsTest.java
Index: DateFormatUtilsTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/time/DateFormatUtilsTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DateFormatUtilsTest.java 8 Jun 2003 23:14:23 -0000 1.1
+++ DateFormatUtilsTest.java 1 Aug 2003 00:12:32 -0000 1.2
@@ -53,6 +53,8 @@
*/
package org.apache.commons.lang.time;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
import java.util.Calendar;
import java.util.TimeZone;
@@ -85,6 +87,17 @@
super(s);
}
+ //-----------------------------------------------------------------------
+ public void testConstructor() {
+ assertNotNull(new DateFormatUtils());
+ Constructor[] cons = DateFormatUtils.class.getDeclaredConstructors();
+ assertEquals(1, cons.length);
+ assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
+ assertEquals(true, Modifier.isPublic(DateFormatUtils.class.getModifiers()));
+ assertEquals(false, Modifier.isFinal(DateFormatUtils.class.getModifiers()));
+ }
+
+ //-----------------------------------------------------------------------
public void testDateTimeISO(){
TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
Calendar cal = Calendar.getInstance(timeZone);
1.3 +13 -0 jakarta-commons/lang/src/test/org/apache/commons/lang/time/DurationFormatUtilsTest.java
Index: DurationFormatUtilsTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/time/DurationFormatUtilsTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DurationFormatUtilsTest.java 18 Jul 2003 17:05:54 -0000 1.2
+++ DurationFormatUtilsTest.java 1 Aug 2003 00:12:32 -0000 1.3
@@ -53,6 +53,8 @@
*/
package org.apache.commons.lang.time;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
import java.util.Calendar;
import java.util.TimeZone;
@@ -86,6 +88,17 @@
super(s);
}
+ //-----------------------------------------------------------------------
+ public void testConstructor() {
+ assertNotNull(new DurationFormatUtils());
+ Constructor[] cons = DurationFormatUtils.class.getDeclaredConstructors();
+ assertEquals(1, cons.length);
+ assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
+ assertEquals(false, Modifier.isPublic(DurationFormatUtils.class.getModifiers()));
+ assertEquals(false, Modifier.isFinal(DurationFormatUtils.class.getModifiers()));
+ }
+
+ //-----------------------------------------------------------------------
public void testFormatWords(){
String text = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org