private void testConcurrentWrite() throws InterruptedException {
  final AtomicInteger detected=new AtomicInteger();
  final AtomicInteger notDetected=new AtomicInteger();
  for (int i=0; i < 10; i++) {
    testConcurrentWrite(detected,notDetected);
  }
  assertTrue(notDetected.get() * 10 <= detected.get());
}

private void testConcurrentWrite ( ) throws InterruptedException { final AtomicInteger detected = new AtomicInteger ( ) ; final AtomicInteger notDetected = new AtomicInteger ( ) ; for ( int i = 0 ; i < 10 ; i ++ ) { testConcurrentWrite ( detected , notDetected ) ; } assertTrue ( notDetected . get ( ) * 10 <= detected . get ( ) ) ; }
test what happens on concurrent write . concurrent write may corrupt the map , so that keys and values may become null .
