ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/DelayQueueTest.java
(Generate patch)

Comparing jsr166/src/test/tck/DelayQueueTest.java (file contents):
Revision 1.54 by jsr166, Tue May 31 16:16:23 2011 UTC vs.
Revision 1.55 by jsr166, Mon Jun 27 20:37:32 2011 UTC

# Line 49 | Line 49 | public class DelayQueueTest extends JSR1
49       */
50      static class PDelay implements Delayed {
51          int pseudodelay;
52 <        PDelay(int i) { pseudodelay = Integer.MIN_VALUE + i; }
53 <        public int compareTo(PDelay y) {
54 <            int i = pseudodelay;
55 <            int j = y.pseudodelay;
56 <            if (i < j) return -1;
57 <            if (i > j) return 1;
58 <            return 0;
52 >        PDelay(int i) { pseudodelay = i; }
53 >        public int compareTo(PDelay other) {
54 >            int a = this.pseudodelay;
55 >            int b = other.pseudodelay;
56 >            return (a < b) ? -1 : (a > b) ? 1 : 0;
57          }
60
58          public int compareTo(Delayed y) {
59              return compareTo((PDelay)y);
60          }
64
61          public boolean equals(Object other) {
62 <            return equals((PDelay)other);
63 <        }
68 <        public boolean equals(PDelay other) {
69 <            return other.pseudodelay == pseudodelay;
62 >            return (other instanceof PDelay) &&
63 >                this.pseudodelay == ((PDelay)other).pseudodelay;
64          }
71
65          public long getDelay(TimeUnit ignore) {
66 <            return pseudodelay;
74 <        }
75 <        public int intValue() {
76 <            return pseudodelay;
66 >            return Integer.MIN_VALUE + pseudodelay;
67          }
78
68          public String toString() {
69              return String.valueOf(pseudodelay);
70          }
# Line 657 | Line 646 | public class DelayQueueTest extends JSR1
646      public void testToString() {
647          DelayQueue q = populatedQueue(SIZE);
648          String s = q.toString();
649 <        for (int i = 0; i < SIZE; ++i) {
650 <            assertTrue(s.contains(String.valueOf(Integer.MIN_VALUE+i)));
662 <        }
649 >        for (Object e : q)
650 >            assertTrue(s.contains(e.toString()));
651      }
652  
653      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines