[cvs] / jsr166 / src / test / tck / AtomicBooleanTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/AtomicBooleanTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27, Fri Jun 17 19:00:48 2016 UTC revision 1.28, Fri Jul 29 21:30:37 2016 UTC
# Line 109  Line 109 
109       * getAndSet returns previous value and sets to given value       * getAndSet returns previous value and sets to given value
110       */       */
111      public void testGetAndSet() {      public void testGetAndSet() {
112          AtomicBoolean ai = new AtomicBoolean(true);          AtomicBoolean ai = new AtomicBoolean();
113          assertEquals(true, ai.getAndSet(false));          boolean[] booleans = { false, true };
114          assertEquals(false, ai.getAndSet(false));          for (boolean before : booleans)
115          assertEquals(false, ai.getAndSet(true));              for (boolean after : booleans) {
116          assertTrue(ai.get());                  ai.set(before);
117                    assertEquals(before, ai.getAndSet(after));
118                    assertEquals(after, ai.get());
119                }
120      }      }
121    
122      /**      /**

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8