IGNITE-10385 Avoid NPE by replacing null fields with zero-length arrays - Fixes ...
authorantkr <antkr.dev@gmail.com>
Fri, 28 Dec 2018 13:53:57 +0000 (16:53 +0300)
committerIlya Kasnacheev <ilya.kasnacheev@gmail.com>
Fri, 28 Dec 2018 13:53:57 +0000 (16:53 +0300)
Signed-off-by: Ilya Kasnacheev <ilya.kasnacheev@gmail.com>
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/CachePartitionPartialCountersMapSelfTest.java

index c594121..08c6259 100644 (file)
@@ -23,9 +23,12 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
+/**
+ *
+ */
 @RunWith(JUnit4.class)
 public class CachePartitionPartialCountersMapSelfTest extends GridCommonAbstractTest {
-
+    /** */
     @Test
     public void testAddAndRemove() throws Exception {
         CachePartitionPartialCountersMap map = new CachePartitionPartialCountersMap(10);
@@ -59,4 +62,15 @@ public class CachePartitionPartialCountersMapSelfTest extends GridCommonAbstract
         }
     }
 
+    /** */
+    @Test
+    public void testEmptyMap() throws Exception {
+        CachePartitionPartialCountersMap map = CachePartitionPartialCountersMap.EMPTY;
+
+        assertFalse(map.remove(1));
+
+        map.trim();
+
+        assertNotNull(map.toString());
+    }
 }