accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [2/2] git commit: ACCUMULO-1627 increased coverage of Condition unit test
Date Tue, 08 Oct 2013 21:05:57 GMT
ACCUMULO-1627 increased coverage of Condition unit test


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/70031c4d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/70031c4d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/70031c4d

Branch: refs/heads/master
Commit: 70031c4dc6f4e8f2448ae888514e3d0b2b811b9c
Parents: 4ac31c3
Author: Keith Turner <kturner@apache.org>
Authored: Tue Oct 8 16:58:23 2013 -0400
Committer: Keith Turner <kturner@apache.org>
Committed: Tue Oct 8 17:04:45 2013 -0400

----------------------------------------------------------------------
 .../accumulo/core/data/ConditionTest.java       | 47 +++++++++++++++++++-
 .../core/data/ConditionalMutationTest.java      |  7 ++-
 2 files changed, 51 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/70031c4d/core/src/test/java/org/apache/accumulo/core/data/ConditionTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ConditionTest.java b/core/src/test/java/org/apache/accumulo/core/data/ConditionTest.java
index 37ffea2..3570610 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ConditionTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/ConditionTest.java
@@ -16,13 +16,17 @@
  */
 package org.apache.accumulo.core.data;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.hadoop.io.Text;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.*;
 
 public class ConditionTest {
   private static final ByteSequence EMPTY = new ArrayByteSequence(new byte[0]);
@@ -164,26 +168,67 @@ public class ConditionTest {
     c3.setTimestamp(1234L);
     c3.setIterators(ITERATORS);
     assertFalse(c.equals(c3));
+    assertFalse(c3.equals(c));
     c3 = new Condition(FAMILY, "nope");
     c3.setVisibility(cvis);
     c3.setValue(VALUE);
     c3.setTimestamp(1234L);
     c3.setIterators(ITERATORS);
     assertFalse(c.equals(c3));
+    assertFalse(c3.equals(c));
 
     c2.setVisibility(new ColumnVisibility("sekrit"));
     assertFalse(c.equals(c2));
+    assertFalse(c2.equals(c));
     c2.setVisibility(cvis);
     c2.setValue(EMPTY);
     assertFalse(c.equals(c2));
+    assertFalse(c2.equals(c));
     c2.setValue(VALUE);
     c2.setTimestamp(2345L);
     assertFalse(c.equals(c2));
+    assertFalse(c2.equals(c));
     c2.setTimestamp(1234L);
     c2.setIterators(new IteratorSetting[0]);
     assertFalse(c.equals(c2));
+    assertFalse(c2.equals(c));
     c2.setIterators(ITERATORS);
     assertTrue(c.equals(c2));
+    assertTrue(c2.equals(c));
+    
+    // set everything but vis, so its null
+    Condition c4 = new Condition(FAMILY, QUALIFIER);
+    c4.setValue(VALUE);
+    c4.setTimestamp(1234L);
+    c4.setIterators(ITERATORS);
+    
+    assertFalse(c.equals(c4));
+    assertFalse(c4.equals(c));
+    
+    // set everything but timestamp, so its null
+    Condition c5 = new Condition(FAMILY, QUALIFIER);
+    c5.setVisibility(cvis);
+    c5.setValue(VALUE);
+    c5.setIterators(ITERATORS);
+    
+    assertFalse(c.equals(c5));
+    assertFalse(c5.equals(c));
+    
+    // set everything but value
+    Condition c6 = new Condition(FAMILY, QUALIFIER);
+    c6.setVisibility(cvis);
+    c6.setTimestamp(1234L);
+    c6.setIterators(ITERATORS);
+    
+    assertFalse(c.equals(c6));
+    assertFalse(c6.equals(c));
+    
+    // test w/ no optional fields set
+    Condition c7 = new Condition(FAMILY, QUALIFIER);
+    Condition c8 = new Condition(FAMILY, QUALIFIER);
+    assertTrue(c7.equals(c8));
+    assertTrue(c8.equals(c7));
+
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/accumulo/blob/70031c4d/core/src/test/java/org/apache/accumulo/core/data/ConditionalMutationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ConditionalMutationTest.java
b/core/src/test/java/org/apache/accumulo/core/data/ConditionalMutationTest.java
index 1dcee99..47f44f1 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ConditionalMutationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/ConditionalMutationTest.java
@@ -16,13 +16,17 @@
  */
 package org.apache.accumulo.core.data;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.util.List;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.hadoop.io.Text;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.*;
 
 public class ConditionalMutationTest {
   private static final byte[] ROW = "row".getBytes(Constants.UTF8);
@@ -138,7 +142,6 @@ public class ConditionalMutationTest {
 
   @Test
   public void testHashcode() {
-    int hc1 = cm.hashCode();
     ConditionalMutation cm2 = new ConditionalMutation(ROW, c1, c2);
     assertTrue(cm.equals(cm2));
     assertEquals(cm2.hashCode(), cm.hashCode());


Mime
View raw message