Author: sebb
Date: Tue Mar 29 15:57:29 2011
New Revision: 1086635
URL: http://svn.apache.org/viewvc?rev=1086635&view=rev
Log:
COmment and update test
Modified:
commons/proper/net/trunk/src/test/java/org/apache/commons/net/imap/IMAPTest.java
Modified:
commons/proper/net/trunk/src/test/java/org/apache/commons/net/imap/IMAPTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/test/java/org/apache/commons/net/imap/IMAPTest.java?rev=1086635&r1=1086634&r2=1086635&view=diff
==============================================================================
---
commons/proper/net/trunk/src/test/java/org/apache/commons/net/imap/IMAPTest.java
(original)
+++
commons/proper/net/trunk/src/test/java/org/apache/commons/net/imap/IMAPTest.java
Tue Mar 29 15:57:29 2011
@@ -27,6 +27,9 @@ public class IMAPTest {
@Test
public void checkGenerator() {
+ // This test assumes:
+ // - 26 letters in the generator alphabet
+ // - the generator uses a fixed size tag
IMAP imap = new IMAP();
String initial = imap.generateCommandID();
int expected = 1;
@@ -34,16 +37,16 @@ public class IMAPTest {
expected *= 26; // letters in alphabet
}
int i=0;
- while(true) {
+ boolean matched=false;
+ while(i <= expected+10) { // don't loop forever, but allow it to pass
go!
i++;
String s = imap.generateCommandID();
- if (initial.equals(s)) { // we've wrapped around completely
- break;
- }
- if (i > expected) {
+ matched = initial.equals(s);
+ if (matched) { // we've wrapped around completely
break;
}
}
Assert.assertEquals(expected, i);
+ Assert.assertTrue("Expected to see the original value again", matched);
}
}