BUG-7464: Fix original porting damage in conditional operations
[yangtools.git] / third-party / triemap / src / test / java / org / opendaylight / yangtools / triemap / TestReadOnlyAndUpdatableIterators.java
index 878aa769d8de2800e3c3c01f6f6b10052dbe2d29..214a2f6f44b0614f61e3047ff42da5967789866b 100644 (file)
@@ -1,29 +1,43 @@
+/*
+ * (C) Copyright 2016 Pantheon Technologies, s.r.o. and others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.opendaylight.yangtools.triemap;
 
 import java.util.Iterator;
 import java.util.Map.Entry;
-
 import org.junit.Before;
 import org.junit.Test;
 
 /***
- * 
+ *
  * Test that read-only iterators do not allow for any updates.
- * Test that non read-only iterators allow for updates. 
+ * Test that non read-only iterators allow for updates.
  *
  */
 public class TestReadOnlyAndUpdatableIterators {
     TrieMap<Integer, Integer> bt;
     private static final int MAP_SIZE = 200;
-    
+
     @Before
     public void setUp() {
-        bt = new TrieMap <Integer, Integer> ();
+        bt = new TrieMap <> ();
         for (int j = 0; j < MAP_SIZE; j++) {
             TestHelper.assertEquals (null, bt.put (Integer.valueOf (j), Integer.valueOf (j)));
-        }                
+        }
     }
-    
+
     @Test
     public void testReadOnlyIterator () {
         Iterator<Entry<Integer, Integer>> it = bt.readOnlyIterator ();
@@ -32,14 +46,14 @@ public class TestReadOnlyAndUpdatableIterators {
             // It should have generated an exception, because it is a read-only iterator
             TestHelper.assertFalse (true);
         } catch (Exception e) {
-            
+
         }
         try {
             it.remove ();
             // It should have generated an exception, because it is a read-only iterator
             TestHelper.assertFalse (true);
         } catch (Exception e) {
-            
+
         }
     }
 
@@ -52,14 +66,14 @@ public class TestReadOnlyAndUpdatableIterators {
             // It should have generated an exception, because it is a read-only iterator
             TestHelper.assertFalse (true);
         } catch (Exception e) {
-            
+
         }
         try {
             it.remove ();
             // It should have generated an exception, because it is a read-only iterator
             TestHelper.assertFalse (true);
         } catch (Exception e) {
-            
+
         }
     }
 
@@ -72,14 +86,14 @@ public class TestReadOnlyAndUpdatableIterators {
             // It should have generated an exception, because it is a read-only iterator
             TestHelper.assertFalse (true);
         } catch (Exception e) {
-            
+
         }
         try {
             it.remove ();
             // It should have generated an exception, because it is a read-only iterator
             TestHelper.assertFalse (true);
         } catch (Exception e) {
-            
+
         }
     }
 
@@ -90,18 +104,18 @@ public class TestReadOnlyAndUpdatableIterators {
             it.next().setValue (0);
         } catch (Exception e) {
             // It should not have generated an exception, because it is a non read-only iterator
-            TestHelper.assertFalse (true);            
+            TestHelper.assertFalse (true);
         }
-        
+
         try {
             it.remove ();
         } catch (Exception e) {
             // It should not have generated an exception, because it is a non read-only iterator
-            TestHelper.assertFalse (true);            
+            TestHelper.assertFalse (true);
         }
-        
+
         // All changes are done on the original map
-        TestHelper.assertEquals (MAP_SIZE - 1, bt.size ());            
+        TestHelper.assertEquals (MAP_SIZE - 1, bt.size ());
     }
 
     @Test
@@ -112,19 +126,19 @@ public class TestReadOnlyAndUpdatableIterators {
             it.next().setValue (0);
         } catch (Exception e) {
             // It should not have generated an exception, because it is a non read-only iterator
-            TestHelper.assertFalse (true);            
+            TestHelper.assertFalse (true);
         }
         try {
             it.remove ();
         } catch (Exception e) {
             // It should not have generated an exception, because it is a non read-only iterator
-            TestHelper.assertFalse (true);            
+            TestHelper.assertFalse (true);
         }
 
         // All changes are done on the snapshot, not on the original map
         // Map size should remain unchanged
         TestHelper.assertEquals (MAP_SIZE, bt.size ());
         // snapshot size was changed
-        TestHelper.assertEquals (MAP_SIZE-1, snapshot.size ());            
+        TestHelper.assertEquals (MAP_SIZE-1, snapshot.size ());
     }
 }