accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [1/2] accumulo git commit: ACCUMULO-4367: fixed use of assertEquals and assertTrue in FilterTest
Date Fri, 22 Jul 2016 14:38:05 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 2f8c8e7a4 -> ad985473a


ACCUMULO-4367: fixed use of assertEquals and assertTrue in FilterTest


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

Branch: refs/heads/master
Commit: f1b0f4f3780136db1a79f056cbc340f84554a742
Parents: 10d29ad
Author: Mike Miller <michaelpmiller@gmail.com>
Authored: Thu Jul 21 14:56:18 2016 -0400
Committer: milleruntime <michaelpmiller@gmail.com>
Committed: Fri Jul 22 08:59:09 2016 -0400

----------------------------------------------------------------------
 .../core/iterators/user/FilterTest.java         | 112 +++++++++----------
 1 file changed, 56 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f1b0f4f3/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java
index e7e2266..6546352 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java
@@ -91,20 +91,20 @@ public class FilterTest {
       Key k = new Key(new Text(String.format("%03d", i)), colf, colq);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     Filter filter1 = new SimpleFilter();
     filter1.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
     filter1.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(filter1);
-    assertTrue("size = " + size, size == 100);
+    assertEquals(100, size);
 
     Filter fi = new SimpleFilter();
     fi.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
     Key k = new Key(new Text("500"));
     fi.seek(new Range(k, null), EMPTY_COL_FAMS, false);
     size = size(fi);
-    assertTrue("size = " + size, size == 50);
+    assertEquals(50, size);
 
     filter1 = new SimpleFilter();
     filter1.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
@@ -112,7 +112,7 @@ public class FilterTest {
     filter2.init(filter1, EMPTY_OPTS, null);
     filter2.seek(new Range(), EMPTY_COL_FAMS, false);
     size = size(filter2);
-    assertTrue("size = " + size, size == 0);
+    assertEquals(0, size);
   }
 
   @Test
@@ -126,7 +126,7 @@ public class FilterTest {
       Key k = new Key(new Text(String.format("%03d", i)), colf, colq);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     Filter filter = new SimpleFilter();
 
@@ -136,20 +136,20 @@ public class FilterTest {
     filter.init(new SortedMapIterator(tm), is.getOptions(), null);
     filter.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(filter);
-    assertTrue("size = " + size, size == 900);
+    assertEquals(900, size);
 
     filter.init(new SortedMapIterator(tm), is.getOptions(), null);
     Key k = new Key(new Text("500"));
     filter.seek(new Range(k, null), EMPTY_COL_FAMS, false);
     size = size(filter);
-    assertTrue("size = " + size, size == 450);
+    assertEquals(450, size);
 
     filter.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
     Filter filter2 = new SimpleFilter2();
     filter2.init(filter, is.getOptions(), null);
     filter2.seek(new Range(), EMPTY_COL_FAMS, false);
     size = size(filter2);
-    assertTrue("size = " + size, size == 100);
+    assertEquals(100, size);
   }
 
   @Test
@@ -163,7 +163,7 @@ public class FilterTest {
       Key k = new Key(new Text(String.format("%03d", i)), colf, colq);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     SimpleFilter filter = new SimpleFilter();
 
@@ -174,10 +174,10 @@ public class FilterTest {
     SortedKeyValueIterator<Key,Value> copy = filter.deepCopy(null);
     filter.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(filter);
-    assertTrue("size = " + size, size == 900);
+    assertEquals(900, size);
     copy.seek(new Range(), EMPTY_COL_FAMS, false);
     size = size(copy);
-    assertTrue("size = " + size, size == 900);
+    assertEquals(900, size);
   }
 
   @Test
@@ -192,7 +192,7 @@ public class FilterTest {
       k.setTimestamp(i);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     SortedKeyValueIterator<Key,Value> a = new AgeOffFilter();
     IteratorSetting is = new IteratorSetting(1, AgeOffFilter.class);
@@ -208,9 +208,9 @@ public class FilterTest {
     a = a.deepCopy(null);
     SortedKeyValueIterator<Key,Value> copy = a.deepCopy(null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 900);
+    assertEquals(900, size(a));
     copy.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(copy), 900);
+    assertEquals(900, size(copy));
   }
 
   @Test
@@ -227,27 +227,27 @@ public class FilterTest {
       Key k = new Key(new Text(String.format("%03d", i)), colf, colq, ts - i);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     ColumnAgeOffFilter a = new ColumnAgeOffFilter();
     assertTrue(a.validateOptions(is.getOptions()));
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 902);
+    assertEquals(902, size(a));
 
     ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("a", "b"), 101l);
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 102);
+    assertEquals(102, size(a));
 
     ColumnAgeOffFilter.removeTTL(is, new IteratorSetting.Column("a", "b"));
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a = (ColumnAgeOffFilter) a.deepCopy(null);
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 902);
+    assertEquals(902, size(a));
   }
 
   /**
@@ -268,27 +268,27 @@ public class FilterTest {
       Key k = new Key(new Text(String.format("%03d", i)), colf, colq, ts - i);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     ColumnAgeOffFilter a = new ColumnAgeOffFilter();
     assertTrue(a.validateOptions(is.getOptions()));
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 98);
+    assertEquals(98, size(a));
 
     ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("a", "b"), 101l);
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 898);
+    assertEquals(898, size(a));
 
     ColumnAgeOffFilter.removeTTL(is, new IteratorSetting.Column("a", "b"));
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a = (ColumnAgeOffFilter) a.deepCopy(null);
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 98);
+    assertEquals(98, size(a));
   }
 
   /**
@@ -308,27 +308,27 @@ public class FilterTest {
       Key k = new Key(new Text(String.format("%03d", i)), colf, colq, ts - i);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     ColumnAgeOffFilter a = new ColumnAgeOffFilter();
     assertTrue(a.validateOptions(is.getOptions()));
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 902);
+    assertEquals(902, size(a));
 
     ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("negate", "b"), 101l);
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 102);
+    assertEquals(102, size(a));
 
     ColumnAgeOffFilter.removeTTL(is, new IteratorSetting.Column("negate", "b"));
     a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
     a = (ColumnAgeOffFilter) a.deepCopy(null);
     a.overrideCurrentTime(ts);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 902);
+    assertEquals(902, size(a));
   }
 
   @Test
@@ -356,24 +356,24 @@ public class FilterTest {
       k.setTimestamp(157l);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     ColumnQualifierFilter a = new ColumnQualifierFilter(new SortedMapIterator(tm), hsc);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 1000);
+    assertEquals(1000, size(a));
 
     hsc = new HashSet<>();
     hsc.add(new Column("a".getBytes(), "b".getBytes(), null));
     a = new ColumnQualifierFilter(new SortedMapIterator(tm), hsc);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(a);
-    assertTrue("size was " + size, size == 500);
+    assertEquals(500, size);
 
     hsc = new HashSet<>();
     a = new ColumnQualifierFilter(new SortedMapIterator(tm), hsc);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     size = size(a);
-    assertTrue("size was " + size, size == 1000);
+    assertEquals(1000, size);
   }
 
   @Test
@@ -392,12 +392,12 @@ public class FilterTest {
       Key k = new Key(new Text(String.format("%03d", i)), new Text("a"), new Text("b"), new
Text(lea[i % 4].getExpression()));
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     VisibilityFilter a = new VisibilityFilter(new SortedMapIterator(tm), auths, le2.getExpression());
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(a);
-    assertTrue("size was " + size, size == 750);
+    assertEquals(750, size);
   }
 
   private ColumnQualifierFilter ncqf(TreeMap<Key,Value> tm, Column... columns) throws
IOException {
@@ -423,25 +423,25 @@ public class FilterTest {
     tm.put(new Key(new Text(String.format("%03d", 4)), new Text("b"), new Text("x")), dv);
     tm.put(new Key(new Text(String.format("%03d", 5)), new Text("b"), new Text("y")), dv);
 
-    assertTrue(tm.size() == 5);
+    assertEquals(5, tm.size());
 
     int size = size(ncqf(tm, new Column("c".getBytes(), null, null)));
-    assertTrue(size == 5);
+    assertEquals(5, size);
 
     size = size(ncqf(tm, new Column("a".getBytes(), null, null)));
-    assertTrue(size == 5);
+    assertEquals(5, size);
 
     size = size(ncqf(tm, new Column("a".getBytes(), "x".getBytes(), null)));
-    assertTrue(size == 1);
+    assertEquals(1, size);
 
     size = size(ncqf(tm, new Column("a".getBytes(), "x".getBytes(), null), new Column("b".getBytes(),
"x".getBytes(), null)));
-    assertTrue(size == 2);
+    assertEquals(2, size);
 
     size = size(ncqf(tm, new Column("a".getBytes(), "x".getBytes(), null), new Column("b".getBytes(),
"y".getBytes(), null)));
-    assertTrue(size == 2);
+    assertEquals(2, size);
 
     size = size(ncqf(tm, new Column("a".getBytes(), "x".getBytes(), null), new Column("b".getBytes(),
null, null)));
-    assertTrue(size == 3);
+    assertEquals(3, size);
   }
 
   @Test
@@ -452,13 +452,13 @@ public class FilterTest {
       Key k = new Key(String.format("%03d", i), "a", "b", i % 10 == 0 ? "vis" : "");
       tm.put(k, v);
     }
-    assertTrue(tm.size() == 1000);
+    assertEquals(1000, tm.size());
 
     Filter filter = new ReqVisFilter();
     filter.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
     filter.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(filter);
-    assertTrue("size = " + size, size == 100);
+    assertEquals(100, size);
   }
 
   @Test
@@ -473,7 +473,7 @@ public class FilterTest {
       k.setTimestamp(i);
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 100);
+    assertEquals(100, tm.size());
 
     SimpleDateFormat dateParser = new SimpleDateFormat("yyyyMMddHHmmssz");
     long baseTime = dateParser.parse("19990101000000GMT").getTime();
@@ -483,57 +483,57 @@ public class FilterTest {
       k.setTimestamp(baseTime + (i * 1000));
       tm.put(k, dv);
     }
-    assertTrue(tm.size() == 100);
+    assertEquals(100, tm.size());
     TimestampFilter a = new TimestampFilter();
     IteratorSetting is = new IteratorSetting(1, TimestampFilter.class);
     TimestampFilter.setRange(is, "19990101010011GMT+01:00", "19990101010031GMT+01:00");
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a = (TimestampFilter) a.deepCopy(null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 21);
+    assertEquals(21, size(a));
     TimestampFilter.setRange(is, baseTime + 11000, baseTime + 31000);
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 21);
+    assertEquals(21, size(a));
 
     TimestampFilter.setEnd(is, "19990101000031GMT", false);
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 20);
+    assertEquals(20, size(a));
 
     TimestampFilter.setStart(is, "19990101000011GMT", false);
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 19);
+    assertEquals(19, size(a));
 
     TimestampFilter.setEnd(is, "19990101000031GMT", true);
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 20);
+    assertEquals(20, size(a));
 
     is.clearOptions();
     TimestampFilter.setStart(is, "19990101000011GMT", true);
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 89);
+    assertEquals(89, size(a));
 
     TimestampFilter.setStart(is, "19990101000011GMT", false);
     assertTrue(a.validateOptions(is.getOptions()));
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 88);
+    assertEquals(88, size(a));
 
     is.clearOptions();
     TimestampFilter.setEnd(is, "19990101000031GMT", true);
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 32);
+    assertEquals(32, size(a));
 
     TimestampFilter.setEnd(is, "19990101000031GMT", false);
     assertTrue(a.validateOptions(is.getOptions()));
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 31);
+    assertEquals(31, size(a));
 
     TimestampFilter.setEnd(is, 253402300800001l, true);
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
@@ -543,14 +543,14 @@ public class FilterTest {
     assertTrue(a.validateOptions(is.getOptions()));
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 89);
+    assertEquals(89, size(a));
 
     is.clearOptions();
     is.addOption(TimestampFilter.END, "19990101000031GMT");
     assertTrue(a.validateOptions(is.getOptions()));
     a.init(new SortedMapIterator(tm), is.getOptions(), null);
     a.seek(new Range(), EMPTY_COL_FAMS, false);
-    assertEquals(size(a), 32);
+    assertEquals(32, size(a));
 
     try {
       a.validateOptions(EMPTY_OPTS);
@@ -575,13 +575,13 @@ public class FilterTest {
     k = new Key(new Text("10"), colf, colq);
     tm.put(k, dv);
 
-    assertTrue(tm.size() == 4);
+    assertEquals(4, tm.size());
 
     Filter filter = new SimpleFilter();
     filter.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
     filter.seek(new Range(), EMPTY_COL_FAMS, false);
     int size = size(filter);
-    assertTrue("size = " + size, size == 3);
+    assertEquals(3, size);
 
   }
 }


Mime
View raw message