3086d9c17df75a51b991682cd751e13995ff2a98
[yangtools.git] / third-party / triemap / src / test / java / org / opendaylight / yangtools / triemap / TestConcurrentMapRemove.java
1 package org.opendaylight.yangtools.triemap;
2
3 import java.util.concurrent.ConcurrentMap;
4 import org.junit.Test;
5
6 public class TestConcurrentMapRemove {
7     private static final int COUNT = 50*1000;
8
9     @Test
10     public void testConcurrentMapRemove () {
11         final ConcurrentMap<Object, Object> map = new TrieMap<> ();
12
13         for (int i = 128; i < COUNT; i++) {
14             TestHelper.assertFalse (map.remove (i, i));
15             TestHelper.assertTrue (null == map.put (i, i));
16             TestHelper.assertFalse (map.remove (i, "lol"));
17             TestHelper.assertTrue (map.containsKey (i));
18             TestHelper.assertTrue (map.remove (i, i));
19             TestHelper.assertFalse (map.containsKey (i));
20             TestHelper.assertTrue (null == map.put (i, i));
21         }
22     }
23 }