commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joe...@apache.org
Subject svn commit: r432853 - /jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGeneratorTest.java
Date Sat, 19 Aug 2006 18:22:24 GMT
Author: joehni
Date: Sat Aug 19 11:22:22 2006
New Revision: 432853

URL: http://svn.apache.org/viewvc?rev=432853&view=rev
Log:
Force IllegalStateException even for time shifts.

Modified:
    jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGeneratorTest.java

Modified: jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGeneratorTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGeneratorTest.java?rev=432853&r1=432852&r2=432853&view=diff
==============================================================================
--- jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGeneratorTest.java
(original)
+++ jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGeneratorTest.java
Sat Aug 19 11:22:22 2006
@@ -85,8 +85,11 @@
         try {
             idGenerator.nextIdentifier();
             idGenerator.nextIdentifier();
-            // ensure exception even if a new time slice has been started between the last
two calls
-            idGenerator.nextIdentifier();
+            // Normally this should have been enough. Unfortunately the test fails, if the
OS is doing
+            // forward time shifts, then we get new ids anyway. So force the exception ...
+            for(int i = 1000; i-- > 0; ) {
+                idGenerator.nextIdentifier();
+            }
             fail("Thrown " + IllegalStateException.class.getName() + " expected");
         } catch (final IllegalStateException e) {
             // OK



---------------------------------------------------------------------
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