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

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

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

revision 1.13, Fri Jan 9 15:39:10 2004 UTC revision 1.14, Sat Jan 10 01:41:59 2004 UTC
# Line 520  Line 520 
520          }          }
521      }      }
522    
523        /**
524         * toString indicates current state
525         */
526        public void testToString() {
527            Mutex lock = new Mutex();
528            String us = lock.toString();
529            assertTrue(us.indexOf("State = 0") >= 0);
530            lock.acquireExclusiveUninterruptibly(1);
531            String ls = lock.toString();
532            assertTrue(ls.indexOf("State = 1") >= 0);
533        }
534    
535        /**
536         * A serialized AQS deserializes with current state
537         */
538        public void testSerialization() {
539            Mutex l = new Mutex();
540            l.acquireExclusiveUninterruptibly(1);
541            assertTrue(l.isLocked());
542    
543            try {
544                ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
545                ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
546                out.writeObject(l);
547                out.close();
548    
549                ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
550                ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
551                Mutex r = (Mutex) in.readObject();
552                assertTrue(r.isLocked());
553            } catch(Exception e){
554                e.printStackTrace();
555                unexpectedException();
556            }
557        }
558    
559    
560      /**      /**
561       * Latch isSignalled initially returns false, then true after release       * Latch isSignalled initially returns false, then true after release
# Line 677  Line 713 
713          }          }
714      }      }
715    
716    
717  }  }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8