You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2018/05/23 23:41:01 UTC
[accumulo] branch master updated: Fixes from automated code
inspections (#498)
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/master by this push:
new f1e56aa Fixes from automated code inspections (#498)
f1e56aa is described below
commit f1e56aae347d233076142074fc3ec219a395c84d
Author: Mike Walch <mw...@apache.org>
AuthorDate: Wed May 23 19:40:57 2018 -0400
Fixes from automated code inspections (#498)
* Simplified JUnit assertions using automated tool
* Fixed javadocs that reference themselves
---
.../client/mapred/AccumuloInputFormatTest.java | 7 +-
.../client/mapreduce/AccumuloInputFormatTest.java | 7 +-
.../lib/partition/RangePartitionerTest.java | 7 +-
.../accumulo/core/client/ClientConfiguration.java | 2 +-
.../core/client/admin/SecurityOperations.java | 4 +-
.../apache/accumulo/fate/zookeeper/ZooCache.java | 9 +--
.../client/impl/ConditionalComparatorTest.java | 2 +-
.../client/impl/TableOperationsHelperTest.java | 4 +-
.../core/client/impl/TabletLocatorImplTest.java | 4 +-
.../core/client/impl/ThriftTransportKeyTest.java | 3 +-
.../core/client/mock/MockConnectorTest.java | 5 +-
.../accumulo/core/client/rfile/RFileTest.java | 2 +-
.../accumulo/core/conf/SiteConfigurationTest.java | 2 +-
.../apache/accumulo/core/data/ConditionTest.java | 54 ++++++-------
.../core/data/ConditionalMutationTest.java | 7 +-
.../org/apache/accumulo/core/data/KeyTest.java | 4 +-
.../apache/accumulo/core/data/MutationTest.java | 3 +-
.../org/apache/accumulo/core/data/RangeTest.java | 4 +-
.../org/apache/accumulo/core/data/ValueTest.java | 12 +--
.../file/blockfile/cache/TestLruBlockCache.java | 48 +++++------
.../apache/accumulo/core/file/rfile/RFileTest.java | 93 +++++++++++-----------
.../accumulo/core/iterators/IteratorUtilTest.java | 35 ++++----
.../iterators/aggregation/NumSummationTest.java | 44 +++++-----
.../iterators/system/DeletingIteratorTest.java | 28 +++----
.../core/iterators/system/MultiIteratorTest.java | 48 +++++------
.../iterators/system/TimeSettingIteratorTest.java | 11 +--
.../core/iterators/user/ColumnSliceFilterTest.java | 57 ++++++-------
.../accumulo/core/iterators/user/CombinerTest.java | 4 +-
.../accumulo/core/iterators/user/FilterTest.java | 5 +-
.../iterators/user/IndexedDocIteratorTest.java | 2 +-
.../iterators/user/IntersectingIteratorTest.java | 11 +--
.../core/iterators/user/RegExFilterTest.java | 29 +++----
.../iterators/user/TransformingIteratorTest.java | 7 +-
.../iterators/user/VersioningIteratorTest.java | 46 ++++++-----
.../user/WholeColumnFamilyIteratorTest.java | 2 +-
.../core/iterators/user/WholeRowIteratorTest.java | 4 +-
.../accumulo/core/security/CredentialsTest.java | 20 ++---
.../org/apache/accumulo/core/util/PairTest.java | 11 ++-
.../apache/accumulo/core/util/TextUtilTest.java | 6 +-
.../core/util/format/FormatterConfigTest.java | 16 ++--
.../minicluster/MiniAccumuloClusterTest.java | 2 +-
.../server/client/deprecated/BulkImporterTest.java | 4 +-
.../constraints/MetadataConstraintsTest.java | 4 +-
.../org/apache/accumulo/server/fs/FileRefTest.java | 12 +--
.../balancer/HostRegexTableLoadBalancerTest.java | 2 +-
.../server/problems/ProblemReportTest.java | 18 ++---
.../server/replication/StatusCombinerTest.java | 6 +-
.../server/replication/proto/StatusTest.java | 2 +-
.../server/security/SystemCredentialsTest.java | 2 +-
.../security/handler/ZKAuthenticatorTest.java | 12 +--
.../accumulo/server/util/TServerUtilsTest.java | 2 +-
.../org/apache/accumulo/master/DefaultMapTest.java | 4 +-
.../monitor/util/AccumuloMonitorAppenderTest.java | 14 ++--
.../org/apache/accumulo/tracer/TracerTest.java | 12 +--
.../apache/accumulo/tserver/InMemoryMapTest.java | 2 +-
.../compaction/TwoTierCompactionStrategyTest.java | 8 +-
.../ConfigurableCompactionStrategyTest.java | 2 +-
.../accumulo/tserver/log/LogFileKeyTest.java | 8 +-
.../accumulo/tserver/logger/LogFileTest.java | 4 +-
.../tserver/tablet/DatafileManagerTest.java | 5 +-
.../vfs/AccumuloReloadingVFSClassLoaderTest.java | 12 +--
.../vfs/AccumuloVFSClassLoaderTest.java | 4 +-
.../start/classloader/vfs/ContextManagerTest.java | 6 +-
.../org/apache/accumulo/test/BalanceFasterIT.java | 3 +-
.../java/org/apache/accumulo/test/CloneIT.java | 3 +-
.../java/org/apache/accumulo/test/LocatorIT.java | 2 +-
.../accumulo/test/NewTableConfigurationIT.java | 6 +-
.../org/apache/accumulo/test/ShellServerIT.java | 13 ++-
.../apache/accumulo/test/TableOperationsIT.java | 2 +-
.../apache/accumulo/test/TransportCachingIT.java | 8 +-
.../java/org/apache/accumulo/test/UsersIT.java | 5 +-
.../accumulo/test/functional/CredentialsIT.java | 7 +-
.../accumulo/test/functional/DurabilityIT.java | 2 +-
.../accumulo/test/functional/NativeMapIT.java | 23 +++---
.../accumulo/test/functional/ShutdownIT.java | 4 +-
.../test/mapred/AccumuloRowInputFormatIT.java | 4 +-
.../test/mapreduce/AccumuloFileOutputFormatIT.java | 3 +-
.../test/mapreduce/AccumuloRowInputFormatIT.java | 4 +-
.../accumulo/test/proxy/SimpleProxyBase.java | 5 +-
.../test/proxy/TestProxyTableOperations.java | 4 +-
...GarbageCollectorCommunicatesWithTServersIT.java | 4 +-
81 files changed, 470 insertions(+), 448 deletions(-)
diff --git a/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java b/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
index 39f7980..d73d9ae 100644
--- a/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
+++ b/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
@@ -17,7 +17,6 @@
package org.apache.accumulo.core.client.mapred;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@@ -75,7 +74,7 @@ public class AccumuloInputFormatTest {
List<IteratorSetting> list = AccumuloInputFormat.getIterators(job);
// Check the list size
- assertTrue(list.size() == 3);
+ assertEquals(3, list.size());
// Walk the list and make sure our settings are correct
IteratorSetting setting = list.get(0);
@@ -150,7 +149,7 @@ public class AccumuloInputFormatTest {
List<IteratorSetting> list = AccumuloInputFormat.getIterators(job);
// Check the list size
- assertTrue(list.size() == 3);
+ assertEquals(3, list.size());
// Walk the list and make sure our settings are correct
IteratorSetting setting = list.get(0);
@@ -179,7 +178,7 @@ public class AccumuloInputFormatTest {
RegExFilter.setRegexs(is, regex, null, null, null, false);
AccumuloInputFormat.addIterator(job, is);
- assertTrue(regex.equals(AccumuloInputFormat.getIterators(job).get(0).getName()));
+ assertEquals(regex, AccumuloInputFormat.getIterators(job).get(0).getName());
}
}
diff --git a/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index 7c635b0..0c85bec 100644
--- a/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -17,7 +17,6 @@
package org.apache.accumulo.core.client.mapreduce;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@@ -72,7 +71,7 @@ public class AccumuloInputFormatTest {
List<IteratorSetting> list = AccumuloInputFormat.getIterators(job);
// Check the list size
- assertTrue(list.size() == 3);
+ assertEquals(3, list.size());
// Walk the list and make sure our settings are correct
IteratorSetting setting = list.get(0);
@@ -150,7 +149,7 @@ public class AccumuloInputFormatTest {
List<IteratorSetting> list = AccumuloInputFormat.getIterators(job);
// Check the list size
- assertTrue(list.size() == 3);
+ assertEquals(3, list.size());
// Walk the list and make sure our settings are correct
IteratorSetting setting = list.get(0);
@@ -181,7 +180,7 @@ public class AccumuloInputFormatTest {
RegExFilter.setRegexs(is, regex, null, null, null, false);
AccumuloInputFormat.addIterator(job, is);
- assertTrue(regex.equals(AccumuloInputFormat.getIterators(job).get(0).getName()));
+ assertEquals(regex, AccumuloInputFormat.getIterators(job).get(0).getName());
}
@Test
diff --git a/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java b/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
index 90e58d2..60d1147 100644
--- a/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
+++ b/client/mapreduce/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.client.mapreduce.lib.partition;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -62,7 +63,7 @@ public class RangePartitionerTest {
private void checkExpectedRangeBins(int numSubBins, String[] strings, int[] rangeEnds)
throws IOException {
- assertTrue(strings.length == rangeEnds.length);
+ assertEquals(strings.length, rangeEnds.length);
for (int i = 0; i < strings.length; ++i) {
int endRange = rangeEnds[i];
int startRange = endRange + 1 - numSubBins;
@@ -74,11 +75,11 @@ public class RangePartitionerTest {
}
private void checkExpectedBins(int numSubBins, String[] strings, int[] bins) throws IOException {
- assertTrue(strings.length == bins.length);
+ assertEquals(strings.length, bins.length);
for (int i = 0; i < strings.length; ++i) {
int bin = bins[i], part = prepPartitioner(numSubBins).findPartition(new Text(strings[i]),
cutArray, numSubBins);
- assertTrue(bin == part);
+ assertEquals(bin, part);
}
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
index 1bd7f78..516cb89 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
@@ -441,7 +441,7 @@ public class ClientConfiguration {
}
/**
- * Same as {@link #withTruststore(String)} with password null and type null
+ * Same as {@link #withTruststore(String, String, String)} with password null and type null
*
*/
public ClientConfiguration withTruststore(String path) {
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java
index 14a6a3c..066fd58 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java
@@ -78,8 +78,8 @@ public interface SecurityOperations {
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission to delete a user
- * @deprecated since 1.5.0; use {@link #dropUser(String)} or the user management functions of your
- * configured authenticator instead.
+ * @deprecated since 1.5.0; use {@link #dropLocalUser(String)} or the user management functions of
+ * your configured authenticator instead.
*/
@Deprecated
void dropUser(String user) throws AccumuloException, AccumuloSecurityException;
diff --git a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
index 1d609f9..5f89726 100644
--- a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
+++ b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
@@ -133,11 +133,10 @@ public class ZooCache {
/**
* Returns a ZooKeeper session. Calls should be made within run of ZooRunnable after caches are
- * checked. This will be performed at each retry of the run method. Calls to
- * {@link #getZooKeeper()} should be made, ideally, after cache checks since other threads may
- * have succeeded when updating the cache. Doing this will ensure that we don't pay the cost of
- * retrieving a ZooKeeper session on each retry until we've ensured the caches aren't populated
- * for a given node.
+ * checked. This will be performed at each retry of the run method. Calls to this method should be
+ * made, ideally, after cache checks since other threads may have succeeded when updating the
+ * cache. Doing this will ensure that we don't pay the cost of retrieving a ZooKeeper session on
+ * each retry until we've ensured the caches aren't populated for a given node.
*
* @return ZooKeeper session.
*/
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ConditionalComparatorTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ConditionalComparatorTest.java
index 5413893..f44f929 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/ConditionalComparatorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ConditionalComparatorTest.java
@@ -36,7 +36,7 @@ public class ConditionalComparatorTest {
ConditionComparator comparator = new ConditionComparator();
- Assert.assertTrue(comparator.compare(c1, c1) == 0);
+ Assert.assertEquals(0, comparator.compare(c1, c1));
Assert.assertTrue(comparator.compare(c1, c2) < 0);
Assert.assertTrue(comparator.compare(c2, c1) > 0);
Assert.assertTrue(comparator.compare(c1, c3) < 0);
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
index 62f736e..799c894 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
@@ -355,11 +355,11 @@ public class TableOperationsHelperTest {
Map<String,EnumSet<IteratorScope>> two = t.listIterators("table");
Assert.assertEquals(2, two.size());
Assert.assertTrue(two.containsKey("otherName"));
- Assert.assertTrue(two.get("otherName").size() == 2);
+ Assert.assertEquals(2, two.get("otherName").size());
Assert.assertTrue(two.get("otherName").contains(IteratorScope.majc));
Assert.assertTrue(two.get("otherName").contains(IteratorScope.scan));
Assert.assertTrue(two.containsKey("someName"));
- Assert.assertTrue(two.get("someName").size() == 1);
+ Assert.assertEquals(1, two.get("someName").size());
Assert.assertTrue(two.get("someName").contains(IteratorScope.majc));
t.removeIterator("table", "someName", EnumSet.allOf(IteratorScope.class));
check(t, "table",
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
index 6d3a133..fd571b0 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
@@ -19,7 +19,7 @@ package org.apache.accumulo.core.client.impl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -1383,7 +1383,7 @@ public class TabletLocatorImplTest {
try {
metaCache.locateTablet(context, new Text("a"), false, false);
- assertTrue(false);
+ fail();
} catch (Exception e) {
}
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ThriftTransportKeyTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ThriftTransportKeyTest.java
index 57fa8cb..a47bee6 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/ThriftTransportKeyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ThriftTransportKeyTest.java
@@ -22,7 +22,6 @@ import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
@@ -135,6 +134,6 @@ public class ThriftTransportKeyTest {
ThriftTransportKey ttk = new ThriftTransportKey(HostAndPort.fromParts("localhost", 9999),
120 * 1000, clientCtx);
- assertTrue("Normal ThriftTransportKey doesn't equal itself", ttk.equals(ttk));
+ assertEquals("Normal ThriftTransportKey doesn't equal itself", ttk, ttk);
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
index 03527b8..bdc796e 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.client.mock;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Collections;
@@ -196,7 +197,7 @@ public class MockConnectorTest {
try {
c.tableOperations().create("test_this_$tableName");
- assertTrue(false);
+ fail();
} catch (IllegalArgumentException iae) {
@@ -307,7 +308,7 @@ public class MockConnectorTest {
try {
c.tableOperations().create("test_this_$tableName");
- assertTrue(false);
+ fail();
} catch (IllegalArgumentException iae) {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileTest.java
index f8f8289..30f9df6 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileTest.java
@@ -284,7 +284,7 @@ public class RFileTest {
Reader reader = getReader(localFs, testFile);
Map<String,ArrayList<ByteSequence>> lGroups = reader.getLocalityGroupCF();
Assert.assertTrue(lGroups.containsKey("z"));
- Assert.assertTrue(lGroups.get("z").size() == 2);
+ Assert.assertEquals(2, lGroups.get("z").size());
Assert.assertTrue(lGroups.get("z").contains(new ArrayByteSequence(colStr(0))));
Assert.assertTrue(lGroups.get("z").contains(new ArrayByteSequence(colStr(1))));
Assert.assertTrue(lGroups.containsKey("h"));
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java
index d931806..e868eeb 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java
@@ -74,7 +74,7 @@ public class SiteConfigurationTest {
siteCfg.getProperties(props, all);
Assert.assertEquals("mysecret", props.get(Property.INSTANCE_SECRET.getKey()));
- Assert.assertEquals(null, props.get("ignored.property"));
+ Assert.assertNull(props.get("ignored.property"));
Assert.assertEquals(Property.GENERAL_RPC_TIMEOUT.getDefaultValue(),
props.get(Property.GENERAL_RPC_TIMEOUT.getKey()));
}
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 bd14805..b0d3f62 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
@@ -20,7 +20,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
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 static org.junit.Assert.assertNotEquals;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.security.ColumnVisibility;
@@ -152,7 +152,7 @@ public class ConditionTest {
c.setIterators(ITERATORS);
// reflexivity
- assertTrue(c.equals(c));
+ assertEquals(c, c);
// non-nullity
assertFalse(c.equals(null));
@@ -163,42 +163,42 @@ public class ConditionTest {
c2.setValue(VALUE);
c2.setTimestamp(1234L);
c2.setIterators(ITERATORS);
- assertTrue(c.equals(c2));
- assertTrue(c2.equals(c));
+ assertEquals(c, c2);
+ assertEquals(c2, c);
Condition c3 = new Condition("nope", QUALIFIER);
c3.setVisibility(cvis);
c3.setValue(VALUE);
c3.setTimestamp(1234L);
c3.setIterators(ITERATORS);
- assertFalse(c.equals(c3));
- assertFalse(c3.equals(c));
+ assertNotEquals(c, c3);
+ assertNotEquals(c3, 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));
+ assertNotEquals(c, c3);
+ assertNotEquals(c3, c);
c2.setVisibility(new ColumnVisibility("sekrit"));
- assertFalse(c.equals(c2));
- assertFalse(c2.equals(c));
+ assertNotEquals(c, c2);
+ assertNotEquals(c2, c);
c2.setVisibility(cvis);
c2.setValue(EMPTY);
- assertFalse(c.equals(c2));
- assertFalse(c2.equals(c));
+ assertNotEquals(c, c2);
+ assertNotEquals(c2, c);
c2.setValue(VALUE);
c2.setTimestamp(2345L);
- assertFalse(c.equals(c2));
- assertFalse(c2.equals(c));
+ assertNotEquals(c, c2);
+ assertNotEquals(c2, c);
c2.setTimestamp(1234L);
c2.setIterators();
- assertFalse(c.equals(c2));
- assertFalse(c2.equals(c));
+ assertNotEquals(c, c2);
+ assertNotEquals(c2, c);
c2.setIterators(ITERATORS);
- assertTrue(c.equals(c2));
- assertTrue(c2.equals(c));
+ assertEquals(c, c2);
+ assertEquals(c2, c);
// set everything but vis, so its null
Condition c4 = new Condition(FAMILY, QUALIFIER);
@@ -206,8 +206,8 @@ public class ConditionTest {
c4.setTimestamp(1234L);
c4.setIterators(ITERATORS);
- assertFalse(c.equals(c4));
- assertFalse(c4.equals(c));
+ assertNotEquals(c, c4);
+ assertNotEquals(c4, c);
// set everything but timestamp, so its null
Condition c5 = new Condition(FAMILY, QUALIFIER);
@@ -215,8 +215,8 @@ public class ConditionTest {
c5.setValue(VALUE);
c5.setIterators(ITERATORS);
- assertFalse(c.equals(c5));
- assertFalse(c5.equals(c));
+ assertNotEquals(c, c5);
+ assertNotEquals(c5, c);
// set everything but value
Condition c6 = new Condition(FAMILY, QUALIFIER);
@@ -224,14 +224,14 @@ public class ConditionTest {
c6.setTimestamp(1234L);
c6.setIterators(ITERATORS);
- assertFalse(c.equals(c6));
- assertFalse(c6.equals(c));
+ assertNotEquals(c, c6);
+ assertNotEquals(c6, 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));
+ assertEquals(c7, c8);
+ assertEquals(c8, c7);
}
@@ -249,7 +249,7 @@ public class ConditionTest {
c2.setValue(VALUE);
c2.setTimestamp(1234L);
c2.setIterators(ITERATORS);
- assertTrue(c.equals(c2));
+ assertEquals(c, c2);
assertEquals(hc1, c2.hashCode());
}
}
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 4326227..cf63437 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
@@ -20,6 +20,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import java.util.List;
@@ -42,7 +43,7 @@ public class ConditionalMutationTest {
public void setUp() throws Exception {
c1 = new Condition(FAMILY, QUALIFIER);
c2 = new Condition(FAMILY, QUALIFIER2);
- assertFalse(c1.equals(c2));
+ assertNotEquals(c1, c2);
cm = new ConditionalMutation(ROW, c1, c2);
}
@@ -119,7 +120,7 @@ public class ConditionalMutationTest {
assertTrue(cm.equals(cm));
// non-nullity
- assertFalse(cm.equals((Object) null));
+ assertNotEquals(cm, (Object) null);
// symmetry
ConditionalMutation cm2 = new ConditionalMutation(ROW, c1, c2);
@@ -129,7 +130,7 @@ public class ConditionalMutationTest {
ConditionalMutation cm3 = new ConditionalMutation("row2".getBytes(UTF_8), c1, c2);
assertFalse(cm.equals(cm3));
cm3 = new ConditionalMutation(ROW, c2, c1);
- assertFalse(cm.getConditions().equals(cm3.getConditions()));
+ assertNotEquals(cm.getConditions(), cm3.getConditions());
assertFalse(cm.equals(cm3));
}
diff --git a/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java b/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java
index 5705174..fe15af0 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/KeyTest.java
@@ -40,8 +40,8 @@ public class KeyTest {
Key k3 = new Key("r1".getBytes(), "cf".getBytes(), "cq".getBytes(), new byte[0], 0, true);
Key k4 = new Key("r1".getBytes(), "cf".getBytes(), "cq".getBytes(), new byte[0], 0, true);
- assertTrue(k1.equals(k2));
- assertTrue(k3.equals(k4));
+ assertEquals(k1, k2);
+ assertEquals(k3, k4);
assertTrue(k1.compareTo(k3) > 0);
assertTrue(k3.compareTo(k1) < 0);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java b/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
index 8206e62..1d84f38 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/MutationTest.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.data;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -632,7 +633,7 @@ public class MutationTest {
assertEquals(m1, m2);
assertEquals(m2, m1);
assertEquals(m2.hashCode(), m1.hashCode());
- assertFalse(0 == m1.hashCode());
+ assertNotEquals(0, m1.hashCode());
assertFalse(m1.equals(m3));
assertFalse(m3.equals(m1));
assertFalse(m1.equals(m4));
diff --git a/core/src/test/java/org/apache/accumulo/core/data/RangeTest.java b/core/src/test/java/org/apache/accumulo/core/data/RangeTest.java
index f5b0117..c4ebcd8 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/RangeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/RangeTest.java
@@ -53,7 +53,7 @@ public class RangeTest extends TestCase {
HashSet<Range> s1 = new HashSet<>(rl);
HashSet<Range> s2 = new HashSet<>(expected);
- assertTrue("got : " + rl + " expected : " + expected, s1.equals(s2));
+ assertEquals("got : " + rl + " expected : " + expected, s1, s2);
}
public void testMergeOverlapping1() {
@@ -579,7 +579,7 @@ public class RangeTest extends TestCase {
private void runClipTest(Range fence, Range range) {
try {
fence.clip(range);
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException e) {
}
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java b/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java
index 93fab1f..9cdfaad 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java
@@ -23,7 +23,7 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -182,7 +182,7 @@ public class ValueTest {
assertTrue(v1.compareTo(v2) < 0);
assertTrue(v2.compareTo(v1) > 0);
Value v1a = new Value(DATA);
- assertTrue(v1.compareTo(v1a) == 0);
+ assertEquals(0, v1.compareTo(v1a));
Value v3 = new Value(toBytes("datc"));
assertTrue(v2.compareTo(v3) < 0);
assertTrue(v1.compareTo(v3) < 0);
@@ -191,12 +191,12 @@ public class ValueTest {
@Test
public void testEquals() {
Value v1 = new Value(DATA);
- assertTrue(v1.equals(v1));
+ assertEquals(v1, v1);
Value v2 = new Value(DATA);
- assertTrue(v1.equals(v2));
- assertTrue(v2.equals(v1));
+ assertEquals(v1, v2);
+ assertEquals(v2, v1);
Value v3 = new Value(toBytes("datb"));
- assertFalse(v1.equals(v3));
+ assertNotEquals(v1, v3);
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
index daf2d1a..5eaea3d 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
@@ -67,7 +67,7 @@ public class TestLruBlockCache extends TestCase {
BlockCacheConfiguration bcc = new BlockCacheConfiguration(cc);
LruBlockCacheConfiguration lbcc = new LruBlockCacheConfiguration(bcc, CacheType.INDEX);
- assertEquals(false, lbcc.isUseEvictionThread());
+ assertFalse(lbcc.isUseEvictionThread());
assertEquals(0.93f, lbcc.getMinFactor());
assertEquals(0.97f, lbcc.getAcceptableFactor());
assertEquals(0.20f, lbcc.getSingleFactor());
@@ -132,7 +132,7 @@ public class TestLruBlockCache extends TestCase {
// Confirm empty
for (Block block : blocks) {
- assertTrue(cache.getBlock(block.blockName) == null);
+ assertNull(cache.getBlock(block.blockName));
}
// Add blocks
@@ -147,7 +147,7 @@ public class TestLruBlockCache extends TestCase {
// Check if all blocks are properly cached and retrieved
for (Block block : blocks) {
CacheEntry ce = cache.getBlock(block.blockName);
- assertTrue(ce != null);
+ assertNotNull(ce);
assertEquals(ce.getBuffer().length, block.buf.length);
}
@@ -157,7 +157,7 @@ public class TestLruBlockCache extends TestCase {
// Check if all blocks are properly cached and retrieved
for (Block block : blocks) {
CacheEntry ce = cache.getBlock(block.blockName);
- assertTrue(ce != null);
+ assertNotNull(ce);
assertEquals(ce.getBuffer().length, block.buf.length);
}
@@ -210,8 +210,8 @@ public class TestLruBlockCache extends TestCase {
assertTrue(cache.heapSize() < (maxSize * LruBlockCacheConfiguration.DEFAULT_ACCEPTABLE_FACTOR));
// All blocks except block 0 and 1 should be in the cache
- assertTrue(cache.getBlock(blocks[0].blockName) == null);
- assertTrue(cache.getBlock(blocks[1].blockName) == null);
+ assertNull(cache.getBlock(blocks[0].blockName));
+ assertNull(cache.getBlock(blocks[1].blockName));
for (int i = 2; i < blocks.length; i++) {
assertTrue(Arrays.equals(cache.getBlock(blocks[i].blockName).getBuffer(), blocks[i].buf));
}
@@ -274,8 +274,8 @@ public class TestLruBlockCache extends TestCase {
// This test makes multi go barely over its limit, in-memory
// empty, and the rest in single. Two single evictions and
// one multi eviction expected.
- assertTrue(cache.getBlock(singleBlocks[0].blockName) == null);
- assertTrue(cache.getBlock(multiBlocks[0].blockName) == null);
+ assertNull(cache.getBlock(singleBlocks[0].blockName));
+ assertNull(cache.getBlock(multiBlocks[0].blockName));
// And all others to be cached
for (int i = 1; i < 4; i++) {
@@ -342,7 +342,7 @@ public class TestLruBlockCache extends TestCase {
assertEquals(1, cache.getEvictedCount());
// Verify oldest single block is the one evicted
- assertEquals(null, cache.getBlock(singleBlocks[0].blockName));
+ assertNull(cache.getBlock(singleBlocks[0].blockName));
// Change the oldest remaining single block to a multi
cache.getBlock(singleBlocks[1].blockName);
@@ -355,7 +355,7 @@ public class TestLruBlockCache extends TestCase {
assertEquals(2, cache.getEvictedCount());
// Oldest multi block should be evicted now
- assertEquals(null, cache.getBlock(multiBlocks[0].blockName));
+ assertNull(cache.getBlock(multiBlocks[0].blockName));
// Insert another memory block
cache.cacheBlock(memoryBlocks[3].blockName, memoryBlocks[3].buf, true);
@@ -365,7 +365,7 @@ public class TestLruBlockCache extends TestCase {
assertEquals(3, cache.getEvictedCount());
// Oldest memory block should be evicted now
- assertEquals(null, cache.getBlock(memoryBlocks[0].blockName));
+ assertNull(cache.getBlock(memoryBlocks[0].blockName));
// Add a block that is twice as big (should force two evictions)
Block[] bigBlocks = generateFixedBlocks(3, blockSize * 3, "big");
@@ -376,9 +376,9 @@ public class TestLruBlockCache extends TestCase {
assertEquals(6, cache.getEvictedCount());
// Expect three remaining singles to be evicted
- assertEquals(null, cache.getBlock(singleBlocks[2].blockName));
- assertEquals(null, cache.getBlock(singleBlocks[3].blockName));
- assertEquals(null, cache.getBlock(singleBlocks[4].blockName));
+ assertNull(cache.getBlock(singleBlocks[2].blockName));
+ assertNull(cache.getBlock(singleBlocks[3].blockName));
+ assertNull(cache.getBlock(singleBlocks[4].blockName));
// Make the big block a multi block
cache.getBlock(bigBlocks[0].blockName);
@@ -391,9 +391,9 @@ public class TestLruBlockCache extends TestCase {
assertEquals(9, cache.getEvictedCount());
// Expect three remaining multis to be evicted
- assertEquals(null, cache.getBlock(singleBlocks[1].blockName));
- assertEquals(null, cache.getBlock(multiBlocks[1].blockName));
- assertEquals(null, cache.getBlock(multiBlocks[2].blockName));
+ assertNull(cache.getBlock(singleBlocks[1].blockName));
+ assertNull(cache.getBlock(multiBlocks[1].blockName));
+ assertNull(cache.getBlock(multiBlocks[2].blockName));
// Cache a big memory block
cache.cacheBlock(bigBlocks[2].blockName, bigBlocks[2].buf, true);
@@ -403,9 +403,9 @@ public class TestLruBlockCache extends TestCase {
assertEquals(12, cache.getEvictedCount());
// Expect three remaining in-memory to be evicted
- assertEquals(null, cache.getBlock(memoryBlocks[1].blockName));
- assertEquals(null, cache.getBlock(memoryBlocks[2].blockName));
- assertEquals(null, cache.getBlock(memoryBlocks[3].blockName));
+ assertNull(cache.getBlock(memoryBlocks[1].blockName));
+ assertNull(cache.getBlock(memoryBlocks[2].blockName));
+ assertNull(cache.getBlock(memoryBlocks[3].blockName));
manager.stop();
}
@@ -449,10 +449,10 @@ public class TestLruBlockCache extends TestCase {
assertEquals(4, cache.getEvictedCount());
// Should have been taken off equally from single and multi
- assertEquals(null, cache.getBlock(singleBlocks[0].blockName));
- assertEquals(null, cache.getBlock(singleBlocks[1].blockName));
- assertEquals(null, cache.getBlock(multiBlocks[0].blockName));
- assertEquals(null, cache.getBlock(multiBlocks[1].blockName));
+ assertNull(cache.getBlock(singleBlocks[0].blockName));
+ assertNull(cache.getBlock(singleBlocks[1].blockName));
+ assertNull(cache.getBlock(multiBlocks[0].blockName));
+ assertNull(cache.getBlock(multiBlocks[1].blockName));
// Let's keep "scanning" by adding single blocks. From here on we only
// expect evictions from the single bucket.
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index e23fbd7..433bfa2 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -18,7 +18,10 @@ package org.apache.accumulo.core.file.rfile;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -341,7 +344,7 @@ public class RFileTest {
trf.iter.seek(new Range((Key) null, null), EMPTY_COL_FAMS, false);
assertFalse(trf.iter.hasTop());
- assertEquals(null, trf.reader.getLastKey());
+ assertNull(trf.reader.getLastKey());
trf.closeReader();
}
@@ -361,8 +364,8 @@ public class RFileTest {
// seek before everything
trf.seek(null);
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("r1", "cf1", "cq1", "L1", 55)));
- assertTrue(trf.iter.getTopValue().equals(newValue("foo")));
+ assertEquals(trf.iter.getTopKey(), newKey("r1", "cf1", "cq1", "L1", 55));
+ assertEquals(trf.iter.getTopValue(), newValue("foo"));
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -373,8 +376,8 @@ public class RFileTest {
// seek exactly to the key
trf.seek(newKey("r1", "cf1", "cq1", "L1", 55));
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("r1", "cf1", "cq1", "L1", 55)));
- assertTrue(trf.iter.getTopValue().equals(newValue("foo")));
+ assertEquals(trf.iter.getTopKey(), newKey("r1", "cf1", "cq1", "L1", 55));
+ assertEquals(trf.iter.getTopValue(), newValue("foo"));
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -567,35 +570,35 @@ public class RFileTest {
trf.writer.append(newKey("r1", "cf1", "cq1", "L1", 55), newValue("foo1"));
try {
trf.writer.append(newKey("r0", "cf1", "cq1", "L1", 55), newValue("foo1"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
try {
trf.writer.append(newKey("r1", "cf0", "cq1", "L1", 55), newValue("foo1"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
try {
trf.writer.append(newKey("r1", "cf1", "cq0", "L1", 55), newValue("foo1"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
try {
trf.writer.append(newKey("r1", "cf1", "cq1", "L0", 55), newValue("foo1"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
try {
trf.writer.append(newKey("r1", "cf1", "cq1", "L1", 56), newValue("foo1"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
@@ -682,7 +685,7 @@ public class RFileTest {
trf.iter.seek(new Range(newKey(formatString("r_", 3), "cf1", "cq1", "L1", 55), true,
newKey(formatString("r_", 4), "cf1", "cq1", "L1", 55), false), EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey(formatString("r_", 3), "cf1", "cq1", "L1", 55)));
+ assertEquals(trf.iter.getTopKey(), newKey(formatString("r_", 3), "cf1", "cq1", "L1", 55));
assertEquals(newValue("foo" + 3), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -714,7 +717,7 @@ public class RFileTest {
trf.iter.seek(new Range(newKey(formatString("r_", 5), "cf1", "cq1", "L1", 55), true,
newKey(formatString("r_", 6), "cf1", "cq1", "L1", 55), false), EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey(formatString("r_", 5), "cf1", "cq1", "L1", 55)));
+ assertEquals(trf.iter.getTopKey(), newKey(formatString("r_", 5), "cf1", "cq1", "L1", 55));
assertEquals(newValue("foo" + 5), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -891,11 +894,11 @@ public class RFileTest {
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0000", "cf1", "doe,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0000", "cf1", "doe,john", "", 4));
assertEquals(newValue("1123 West Left st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0002", "cf2", "doe,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0002", "cf2", "doe,jane", "", 5));
assertEquals(newValue("1124 East Right st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -907,11 +910,11 @@ public class RFileTest {
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0001", "cf3", "buck,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0001", "cf3", "buck,john", "", 4));
assertEquals(newValue("90 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0003", "cf4", "buck,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0003", "cf4", "buck,jane", "", 5));
assertEquals(newValue("09 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -923,19 +926,19 @@ public class RFileTest {
assertEquals(2, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0000", "cf1", "doe,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0000", "cf1", "doe,john", "", 4));
assertEquals(newValue("1123 West Left st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0001", "cf3", "buck,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0001", "cf3", "buck,john", "", 4));
assertEquals(newValue("90 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0002", "cf2", "doe,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0002", "cf2", "doe,jane", "", 5));
assertEquals(newValue("1124 East Right st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0003", "cf4", "buck,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0003", "cf4", "buck,jane", "", 5));
assertEquals(newValue("09 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -954,7 +957,7 @@ public class RFileTest {
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0003", "cf4", "buck,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0003", "cf4", "buck,jane", "", 5));
assertEquals(newValue("09 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -966,7 +969,7 @@ public class RFileTest {
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0001", "cf3", "buck,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0001", "cf3", "buck,john", "", 4));
assertEquals(newValue("90 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -978,7 +981,7 @@ public class RFileTest {
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0000", "cf1", "doe,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0000", "cf1", "doe,john", "", 4));
assertEquals(newValue("1123 West Left st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -990,7 +993,7 @@ public class RFileTest {
assertEquals(1, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0002", "cf2", "doe,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0002", "cf2", "doe,jane", "", 5));
assertEquals(newValue("1124 East Right st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -1002,11 +1005,11 @@ public class RFileTest {
assertEquals(2, trf.reader.getNumLocalityGroupsSeeked());
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0000", "cf1", "doe,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0000", "cf1", "doe,john", "", 4));
assertEquals(newValue("1123 West Left st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0003", "cf4", "buck,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0003", "cf4", "buck,jane", "", 5));
assertEquals(newValue("09 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -1047,11 +1050,11 @@ public class RFileTest {
trf.openReader();
trf.iter.seek(new Range(new Text(""), null), EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0000", "cf1", "doe,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0000", "cf1", "doe,john", "", 4));
assertEquals(newValue("1123 West Left st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0002", "cf2", "doe,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0002", "cf2", "doe,jane", "", 5));
assertEquals(newValue("1124 East Right st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -1072,11 +1075,11 @@ public class RFileTest {
trf.openReader();
trf.iter.seek(new Range(new Text(""), null), EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0001", "cf3", "buck,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0001", "cf3", "buck,john", "", 4));
assertEquals(newValue("90 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0003", "cf4", "buck,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0003", "cf4", "buck,jane", "", 5));
assertEquals(newValue("09 Slum st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -1097,11 +1100,11 @@ public class RFileTest {
trf.openReader();
trf.iter.seek(new Range(new Text(""), null), EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0007", "good citizen", "q,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0007", "good citizen", "q,john", "", 4));
assertEquals(newValue("70 Apple st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0008", "model citizen", "q,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0008", "model citizen", "q,jane", "", 5));
assertEquals(newValue("81 Plum st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -1124,19 +1127,19 @@ public class RFileTest {
trf.openReader();
trf.iter.seek(new Range(new Text(""), null), EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0000", "cf1", "doe,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0000", "cf1", "doe,john", "", 4));
assertEquals(newValue("1123 West Left st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0002", "cf2", "doe,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0002", "cf2", "doe,jane", "", 5));
assertEquals(newValue("1124 East Right st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0007", "good citizen", "q,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0007", "good citizen", "q,john", "", 4));
assertEquals(newValue("70 Apple st"), trf.iter.getTopValue());
trf.iter.next();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0008", "model citizen", "q,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0008", "model citizen", "q,jane", "", 5));
assertEquals(newValue("81 Plum st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -1273,7 +1276,7 @@ public class RFileTest {
try {
trf.writer.append(newKey("0009", "c", "cq1", "", 4), newValue("1"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
@@ -1308,14 +1311,14 @@ public class RFileTest {
try {
trf.writer.append(newKey("0008", "a", "cq1", "", 4), newValue("1"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
try {
trf.writer.append(newKey("0009", "b", "cq1", "", 4), newValue("1"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
@@ -1343,14 +1346,14 @@ public class RFileTest {
trf.writer.startDefaultLocalityGroup();
try {
trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("a", "b"));
- assertFalse(true);
+ fail();
} catch (IllegalStateException ioe) {
}
try {
trf.writer.startDefaultLocalityGroup();
- assertFalse(true);
+ fail();
} catch (IllegalStateException ioe) {
}
@@ -1369,7 +1372,7 @@ public class RFileTest {
trf.writer.append(newKey("0007", "a", "cq1", "", 4), newValue("1"));
try {
trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("b", "c"));
- assertFalse(true);
+ fail();
} catch (IllegalArgumentException ioe) {
}
@@ -1602,7 +1605,7 @@ public class RFileTest {
trf.iter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0000", "cf1", "doe,john", "", 4)));
+ assertEquals(trf.iter.getTopKey(), newKey("0000", "cf1", "doe,john", "", 4));
assertEquals(newValue("1123 West Left st"), trf.iter.getTopValue());
trf.iter.next();
@@ -1617,7 +1620,7 @@ public class RFileTest {
in.close();
assertTrue(trf.iter.hasTop());
- assertTrue(trf.iter.getTopKey().equals(newKey("0002", "cf2", "doe,jane", "", 5)));
+ assertEquals(trf.iter.getTopKey(), newKey("0002", "cf2", "doe,jane", "", 5));
assertEquals(newValue("1124 East Right st"), trf.iter.getTopValue());
trf.iter.next();
assertFalse(trf.iter.hasTop());
@@ -2354,7 +2357,7 @@ public class RFileTest {
testRfile.iter.seek(new Range((Key) null, null), EMPTY_COL_FAMS, false);
assertTrue(testRfile.iter.hasTop());
- assertTrue(testRfile.reader.getLastKey() != null);
+ assertNotNull(testRfile.reader.getLastKey());
testRfile.closeReader();
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/IteratorUtilTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/IteratorUtilTest.java
index 265ad46..64ba93b 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/IteratorUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/IteratorUtilTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.iterators;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -152,14 +153,14 @@ public class IteratorUtilTest {
iter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(1, 0)));
- assertTrue(iter.getTopValue().toString().equals("4"));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(1, 0));
+ assertEquals("4", iter.getTopValue().toString());
iter.next();
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(2, 0)));
- assertTrue(iter.getTopValue().toString().equals("9"));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(2, 0));
+ assertEquals("9", iter.getTopValue().toString());
iter.next();
@@ -184,14 +185,14 @@ public class IteratorUtilTest {
iter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(1, 0)));
- assertTrue(iter.getTopValue().toString().equals("1"));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(1, 0));
+ assertEquals("1", iter.getTopValue().toString());
iter.next();
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(2, 0)));
- assertTrue(iter.getTopValue().toString().equals("2"));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(2, 0));
+ assertEquals("2", iter.getTopValue().toString());
iter.next();
@@ -222,14 +223,14 @@ public class IteratorUtilTest {
iter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(1, 0)));
- assertTrue(iter.getTopValue().toString().equals("2"));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(1, 0));
+ assertEquals("2", iter.getTopValue().toString());
iter.next();
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(2, 0)));
- assertTrue(iter.getTopValue().toString().equals("5"));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(2, 0));
+ assertEquals("5", iter.getTopValue().toString());
iter.next();
@@ -261,14 +262,14 @@ public class IteratorUtilTest {
iter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(1, 0)));
- assertTrue(iter.getTopValue().toString().equals("64"));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(1, 0));
+ assertEquals("64", iter.getTopValue().toString());
iter.next();
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(2, 0)));
- assertTrue(iter.getTopValue().toString().equals("81"));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(2, 0));
+ assertEquals("81", iter.getTopValue().toString());
iter.next();
@@ -299,7 +300,7 @@ public class IteratorUtilTest {
iter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(iter.hasTop());
- assertTrue(iter.getTopKey().equals(MultiIteratorTest.newKey(2, 950)));
+ assertEquals(iter.getTopKey(), MultiIteratorTest.newKey(2, 950));
iter.next();
assertFalse(iter.hasTop());
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/NumSummationTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/NumSummationTest.java
index cf9057a..680f385 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/NumSummationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/NumSummationTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.accumulo.core.iterators.aggregation;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.IOException;
@@ -48,12 +48,12 @@ public class NumSummationTest {
byte[] b = NumArraySummation.longArrayToBytes(la);
long[] la2 = NumArraySummation.bytesToLongArray(b);
- assertTrue(la.length == la2.length);
+ assertEquals(la.length, la2.length);
for (int i = 0; i < la.length; i++) {
- assertTrue(i + ": " + la[i] + " does not equal " + la2[i], la[i] == la2[i]);
+ assertEquals(i + ": " + la[i] + " does not equal " + la2[i], la[i], la2[i]);
}
} catch (Exception e) {
- assertTrue(false);
+ fail();
}
}
@@ -66,17 +66,17 @@ public class NumSummationTest {
long[] la2 = {3L, 2L, 1L, 0L};
nas.collect(new Value(NumArraySummation.longArrayToBytes(la2)));
la = NumArraySummation.bytesToLongArray(nas.aggregate().get());
- assertTrue(la.length == 4);
+ assertEquals(4, la.length);
for (int i = 0; i < la.length - 1; i++) {
- assertTrue(la[i] == 4);
+ assertEquals(4, la[i]);
}
- assertTrue(la[la.length - 1] == 0);
+ assertEquals(0, la[la.length - 1]);
nas.reset();
la = NumArraySummation.bytesToLongArray(nas.aggregate().get());
- assertTrue(la.length == 0);
+ assertEquals(0, la.length);
} catch (Exception e) {
log.error("{}", e.getMessage(), e);
- assertTrue(false);
+ fail();
}
}
@@ -89,14 +89,14 @@ public class NumSummationTest {
long[] la2 = {1L, -3L, 2L, 10L};
nas.collect(new Value(NumArraySummation.longArrayToBytes(la2)));
la = NumArraySummation.bytesToLongArray(nas.aggregate().get());
- assertTrue(la.length == 6);
+ assertEquals(6, la.length);
for (int i = 2; i < la.length; i++) {
- assertTrue(la[i] == 5);
+ assertEquals(5, la[i]);
}
- assertTrue("max long plus one was " + la[0], la[0] == Long.MAX_VALUE);
- assertTrue("min long minus 3 was " + la[1], la[1] == Long.MIN_VALUE);
+ assertEquals("max long plus one was " + la[0], la[0], Long.MAX_VALUE);
+ assertEquals("min long minus 3 was " + la[1], la[1], Long.MIN_VALUE);
} catch (Exception e) {
- assertTrue(false);
+ fail();
}
}
@@ -107,9 +107,9 @@ public class NumSummationTest {
byte[] b = NumSummation.longToBytes(l);
long l2 = NumSummation.bytesToLong(b);
- assertTrue(l == l2);
+ assertEquals(l, l2);
} catch (Exception e) {
- assertTrue(false);
+ fail();
}
}
@@ -121,27 +121,27 @@ public class NumSummationTest {
ns.collect(new Value(NumSummation.longToBytes(l)));
}
long l = NumSummation.bytesToLong(ns.aggregate().get());
- assertTrue("l was " + l, l == 13);
+ assertEquals("l was " + l, 13, l);
ns.collect(new Value(NumSummation.longToBytes(Long.MAX_VALUE)));
l = NumSummation.bytesToLong(ns.aggregate().get());
- assertTrue("l was " + l, l == Long.MAX_VALUE);
+ assertEquals("l was " + l, l, Long.MAX_VALUE);
ns.collect(new Value(NumSummation.longToBytes(Long.MIN_VALUE)));
l = NumSummation.bytesToLong(ns.aggregate().get());
- assertTrue("l was " + l, l == -1);
+ assertEquals("l was " + l, l, -1);
ns.collect(new Value(NumSummation.longToBytes(Long.MIN_VALUE)));
l = NumSummation.bytesToLong(ns.aggregate().get());
- assertTrue("l was " + l, l == Long.MIN_VALUE);
+ assertEquals("l was " + l, l, Long.MIN_VALUE);
ns.collect(new Value(NumSummation.longToBytes(Long.MIN_VALUE)));
l = NumSummation.bytesToLong(ns.aggregate().get());
- assertTrue("l was " + l, l == Long.MIN_VALUE);
+ assertEquals("l was " + l, l, Long.MIN_VALUE);
ns.reset();
l = NumSummation.bytesToLong(ns.aggregate().get());
- assertTrue("l was " + l, l == 0);
+ assertEquals("l was " + l, 0, l);
} catch (IOException | RuntimeException e) {
fail();
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java
index 3895985..d0b6a1f 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/DeletingIteratorTest.java
@@ -60,7 +60,7 @@ public class DeletingIteratorTest extends TestCase {
tm.put(k, dvNew);
}
}
- assertTrue("Initial size was " + tm.size(), tm.size() == 21);
+ assertEquals("Initial size was " + tm.size(), 21, tm.size());
Text checkRow = new Text("000");
try {
@@ -72,17 +72,17 @@ public class DeletingIteratorTest extends TestCase {
tmOut.put(it.getTopKey(), it.getTopValue());
it.next();
}
- assertTrue("size after no propagation was " + tmOut.size(), tmOut.size() == 15);
+ assertEquals("size after no propagation was " + tmOut.size(), 15, tmOut.size());
for (Entry<Key,Value> e : tmOut.entrySet()) {
if (e.getKey().getRow().equals(checkRow)) {
byte[] b = e.getValue().get();
- assertTrue(b[0] == 'n');
- assertTrue(b[1] == 'e');
- assertTrue(b[2] == 'w');
+ assertEquals('n', b[0]);
+ assertEquals('e', b[1]);
+ assertEquals('w', b[2]);
}
}
} catch (IOException e) {
- assertFalse(true);
+ fail();
}
try {
@@ -93,23 +93,23 @@ public class DeletingIteratorTest extends TestCase {
tmOut.put(it.getTopKey(), it.getTopValue());
it.next();
}
- assertTrue("size after propagation was " + tmOut.size(), tmOut.size() == 16);
+ assertEquals("size after propagation was " + tmOut.size(), 16, tmOut.size());
for (Entry<Key,Value> e : tmOut.entrySet()) {
if (e.getKey().getRow().equals(checkRow)) {
byte[] b = e.getValue().get();
if (e.getKey().isDeleted()) {
- assertTrue(b[0] == 'o');
- assertTrue(b[1] == 'l');
- assertTrue(b[2] == 'd');
+ assertEquals('o', b[0]);
+ assertEquals('l', b[1]);
+ assertEquals('d', b[2]);
} else {
- assertTrue(b[0] == 'n');
- assertTrue(b[1] == 'e');
- assertTrue(b[2] == 'w');
+ assertEquals('n', b[0]);
+ assertEquals('e', b[1]);
+ assertEquals('w', b[2]);
}
}
}
} catch (IOException e) {
- assertFalse(true);
+ fail();
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java
index ae290fb..e6eca1c 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java
@@ -275,50 +275,50 @@ public class MultiIteratorTest extends TestCase {
mi.seek(new Range(null, true, newKey(5, 9), false), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(newKey(3, 0)));
- assertTrue(mi.getTopValue().toString().equals("1"));
+ assertEquals(mi.getTopKey(), newKey(3, 0));
+ assertEquals("1", mi.getTopValue().toString());
mi.next();
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(newKey(4, 0)));
- assertTrue(mi.getTopValue().toString().equals("2"));
+ assertEquals(mi.getTopKey(), newKey(4, 0));
+ assertEquals("2", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
mi.seek(new Range(newKey(4, 10), true, newKey(5, 9), false), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(newKey(4, 0)));
- assertTrue(mi.getTopValue().toString().equals("2"));
+ assertEquals(mi.getTopKey(), newKey(4, 0));
+ assertEquals("2", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
mi.seek(new Range(newKey(4, 10), true, newKey(6, 0), false), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(newKey(4, 0)));
- assertTrue(mi.getTopValue().toString().equals("2"));
+ assertEquals(mi.getTopKey(), newKey(4, 0));
+ assertEquals("2", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
mi.seek(new Range(newKey(4, 10), true, newKey(6, 0), true), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(newKey(4, 0)));
- assertTrue(mi.getTopValue().toString().equals("2"));
+ assertEquals(mi.getTopKey(), newKey(4, 0));
+ assertEquals("2", mi.getTopValue().toString());
mi.next();
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(newKey(6, 0)));
- assertTrue(mi.getTopValue().toString().equals("3"));
+ assertEquals(mi.getTopKey(), newKey(6, 0));
+ assertEquals("3", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
mi.seek(new Range(newKey(4, 0), true, newKey(6, 0), false), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(newKey(4, 0)));
- assertTrue(mi.getTopValue().toString().equals("2"));
+ assertEquals(mi.getTopKey(), newKey(4, 0));
+ assertEquals("2", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
@@ -328,8 +328,8 @@ public class MultiIteratorTest extends TestCase {
mi.seek(new Range(newKey(4, 0), false, newKey(6, 0), true), EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopKey().equals(newKey(6, 0)));
- assertTrue(mi.getTopValue().toString().equals("3"));
+ assertEquals(mi.getTopKey(), newKey(6, 0));
+ assertEquals("3", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
@@ -358,44 +358,44 @@ public class MultiIteratorTest extends TestCase {
Range r1 = new Range((Text) null, (Text) null);
mi.seek(r1, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopValue().toString().equals("5"));
+ assertEquals("5", mi.getTopValue().toString());
mi.next();
assertTrue(mi.hasTop());
- assertTrue(mi.getTopValue().toString().equals("6"));
+ assertEquals("6", mi.getTopValue().toString());
mi.next();
assertTrue(mi.hasTop());
- assertTrue(mi.getTopValue().toString().equals("7"));
+ assertEquals("7", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
Range r2 = new Range(newKey(0, 0), true, newKey(1, 1), true);
mi.seek(r2, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopValue().toString().equals("5"));
+ assertEquals("5", mi.getTopValue().toString());
mi.next();
assertTrue(mi.hasTop());
- assertTrue(mi.getTopValue().toString().equals("6"));
+ assertEquals("6", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
Range r3 = new Range(newKey(0, 0), false, newKey(1, 1), false);
mi.seek(r3, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopValue().toString().equals("5"));
+ assertEquals("5", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
Range r4 = new Range(newKey(1, 2), true, newKey(1, 1), false);
mi.seek(r4, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopValue().toString().equals("5"));
+ assertEquals("5", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
Range r5 = new Range(newKey(1, 2), false, newKey(1, 1), true);
mi.seek(r5, EMPTY_COL_FAMS, false);
assertTrue(mi.hasTop());
- assertTrue(mi.getTopValue().toString().equals("6"));
+ assertEquals("6", mi.getTopValue().toString());
mi.next();
assertFalse(mi.hasTop());
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
index aa2178e..c25d07e 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
@@ -18,6 +18,7 @@ package org.apache.accumulo.core.iterators.system;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -106,7 +107,7 @@ public class TimeSettingIteratorTest {
assertTrue(tsi.hasTop());
final Key topKey = tsi.getTopKey();
- assertTrue("Expected the topKey to be the same object", k == topKey);
+ assertSame("Expected the topKey to be the same object", k, topKey);
assertEquals(new Key("r0", "cf1", "cq1", 50L), topKey);
assertEquals("v0", tsi.getTopValue().toString());
tsi.next();
@@ -139,12 +140,12 @@ public class TimeSettingIteratorTest {
it.seek(testRange, new HashSet<>(), false);
assertTrue(it.hasTop());
- assertTrue(it.getTopValue().equals(new Value("00".getBytes())));
- assertTrue(it.getTopKey().getTimestamp() == 111L);
+ assertEquals(it.getTopValue(), new Value("00".getBytes()));
+ assertEquals(111L, it.getTopKey().getTimestamp());
it.next();
assertTrue(it.hasTop());
- assertTrue(it.getTopValue().equals(new Value("11".getBytes())));
- assertTrue(it.getTopKey().getTimestamp() == 111L);
+ assertEquals(it.getTopValue(), new Value("11".getBytes()));
+ assertEquals(111L, it.getTopKey().getTimestamp());
it.next();
assertFalse(it.hasTop());
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java
index e8ac5a4..94681a3 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/ColumnSliceFilterTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.iterators.user;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -82,13 +83,13 @@ public class ColumnSliceFilterTest {
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, true);
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
@@ -102,16 +103,16 @@ public class ColumnSliceFilterTest {
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_4));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_4);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
@@ -125,10 +126,10 @@ public class ColumnSliceFilterTest {
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
@@ -142,13 +143,13 @@ public class ColumnSliceFilterTest {
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_4));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_4);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
@@ -162,16 +163,16 @@ public class ColumnSliceFilterTest {
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_1));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_1);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
@@ -185,19 +186,19 @@ public class ColumnSliceFilterTest {
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_4));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_4);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_5));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_5);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
@@ -211,22 +212,22 @@ public class ColumnSliceFilterTest {
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_1));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_1);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_4));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_4);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_5));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_5);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
@@ -270,7 +271,7 @@ public class ColumnSliceFilterTest {
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
- assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
+ assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
index 9ebbc55..b6a9b66 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/CombinerTest.java
@@ -895,8 +895,8 @@ public class CombinerTest {
String logMsgs = writer.toString();
if (expectedLog == null) {
- Assert.assertTrue("Expected 0 length log message, but got : " + logMsgs,
- logMsgs.length() == 0);
+ Assert.assertEquals("Expected 0 length log message, but got : " + logMsgs, 0,
+ logMsgs.length());
} else {
logMsgs = logMsgs.replace('\n', ' ');
Assert.assertTrue("Did not match pattern [" + expectedLog + "] in [" + logMsgs + "]",
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 241ccc4..0bd2803 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
@@ -18,6 +18,7 @@ package org.apache.accumulo.core.iterators.user;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.IOException;
import java.text.ParseException;
@@ -198,7 +199,7 @@ public class FilterTest {
assertTrue(((AgeOffFilter) a).validateOptions(is.getOptions()));
try {
((AgeOffFilter) a).validateOptions(EMPTY_OPTS);
- assertTrue(false);
+ fail();
} catch (IllegalArgumentException e) {}
a.init(new SortedMapIterator(tm), is.getOptions(), null);
a = a.deepCopy(null);
@@ -559,7 +560,7 @@ public class FilterTest {
try {
a.validateOptions(EMPTY_OPTS);
- assertTrue(false);
+ fail();
} catch (IllegalArgumentException e) {}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
index dab8899..fdac86a 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
@@ -339,7 +339,7 @@ public class IndexedDocIteratorTest extends TestCase {
assertTrue(new String(v.get()).endsWith(" docID=" + d));
iter.next();
}
- assertTrue(hitCount == docs.size());
+ assertEquals(hitCount, docs.size());
cleanup();
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
index 2b82531..5c9f0b5 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.iterators.user;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -152,7 +153,7 @@ public class IntersectingIteratorTest {
assertTrue(docs.contains(k.getColumnQualifier()));
iter.next();
}
- assertTrue(hitCount == docs.size());
+ assertEquals(hitCount, docs.size());
cleanup();
}
@@ -183,7 +184,7 @@ public class IntersectingIteratorTest {
assertTrue(docs.contains(k.getColumnQualifier()));
iter.next();
}
- assertTrue(hitCount == docs.size());
+ assertEquals(hitCount, docs.size());
cleanup();
}
@@ -223,7 +224,7 @@ public class IntersectingIteratorTest {
assertTrue(docs.contains(k.getColumnQualifier()));
iter.next();
}
- assertTrue(hitCount == docs.size());
+ assertEquals(hitCount, docs.size());
cleanup();
}
@@ -261,7 +262,7 @@ public class IntersectingIteratorTest {
assertTrue(docs.contains(k.getColumnQualifier()));
iter.next();
}
- assertTrue(hitCount == docs.size());
+ assertEquals(hitCount, docs.size());
cleanup();
}
@@ -290,7 +291,7 @@ public class IntersectingIteratorTest {
assertTrue(docs.contains(k.getColumnQualifier()));
iter.next();
}
- assertTrue(hitCount == docs.size());
+ assertEquals(hitCount, docs.size());
cleanup();
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
index 181c46b..cbd99c2 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
@@ -17,6 +17,7 @@
package org.apache.accumulo.core.iterators.user;
import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -68,7 +69,7 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k3));
+ assertEquals(rei.getTopKey(), k3);
rei.next();
assertFalse(rei.hasTop());
@@ -83,7 +84,7 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k3));
+ assertEquals(rei.getTopKey(), k3);
rei.next();
assertFalse(rei.hasTop());
@@ -96,7 +97,7 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k2));
+ assertEquals(rei.getTopKey(), k2);
rei.next();
assertFalse(rei.hasTop());
@@ -109,7 +110,7 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k1));
+ assertEquals(rei.getTopKey(), k1);
rei.next();
assertFalse(rei.hasTop());
@@ -122,7 +123,7 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k2));
+ assertEquals(rei.getTopKey(), k2);
rei.next();
assertFalse(rei.hasTop());
@@ -143,7 +144,7 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k2));
+ assertEquals(rei.getTopKey(), k2);
rei.next();
assertFalse(rei.hasTop());
@@ -164,10 +165,10 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k2));
+ assertEquals(rei.getTopKey(), k2);
rei.next();
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k1));
+ assertEquals(rei.getTopKey(), k1);
rei.next();
assertFalse(rei.hasTop());
@@ -178,13 +179,13 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k2));
+ assertEquals(rei.getTopKey(), k2);
rei.next();
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k1));
+ assertEquals(rei.getTopKey(), k1);
rei.next();
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k3));
+ assertEquals(rei.getTopKey(), k3);
rei.next();
assertFalse(rei.hasTop());
@@ -196,7 +197,7 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k3));
+ assertEquals(rei.getTopKey(), k3);
rei.next();
assertFalse(rei.hasTop());
@@ -208,7 +209,7 @@ public class RegExFilterTest {
rei.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(rei.hasTop());
- assertTrue(rei.getTopKey().equals(k2));
+ assertEquals(rei.getTopKey(), k2);
rei.next();
assertFalse(rei.hasTop());
@@ -236,7 +237,7 @@ public class RegExFilterTest {
assertTrue(rei.hasTop());
Value outValue = rei.getTopValue();
String outVal = new String(outValue.get(), UTF_8);
- assertTrue(outVal.equals(multiByteText));
+ assertEquals(outVal, multiByteText);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
index 04c1641..002894c 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.ArrayList;
@@ -368,7 +369,7 @@ public class TransformingIteratorTest {
setUpTransformIterator(IllegalVisCompactionKeyTransformingIterator.class);
try {
checkExpected(new TreeMap<>());
- assertTrue(false);
+ fail();
} catch (Exception e) {
}
@@ -412,14 +413,14 @@ public class TransformingIteratorTest {
opts.put(TransformingIterator.MAX_BUFFER_SIZE_OPT, "A,B");
try {
ti.validateOptions(opts);
- Assert.assertFalse(true);
+ Assert.fail();
} catch (IllegalArgumentException e) {}
opts.clear();
opts.put(TransformingIterator.AUTH_OPT, Authorizations.HEADER + "~~~~");
try {
ti.validateOptions(opts);
- Assert.assertFalse(true);
+ Assert.fail();
} catch (IllegalArgumentException e) {}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java
index 57111aa..4836c82 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/VersioningIteratorTest.java
@@ -16,8 +16,10 @@
*/
package org.apache.accumulo.core.iterators.user;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.ArrayList;
@@ -53,7 +55,7 @@ public class VersioningIteratorTest {
}
}
- assertTrue("Initial size was " + tm.size(), tm.size() == 40);
+ assertEquals("Initial size was " + tm.size(), 40, tm.size());
}
TreeMap<Key,Value> iteratorOverTestData(VersioningIterator it) throws IOException {
@@ -85,15 +87,15 @@ public class VersioningIteratorTest {
TreeMap<Key,Value> tmOut = iteratorOverTestData(it);
for (Entry<Key,Value> e : tmOut.entrySet()) {
- assertTrue(e.getValue().get().length == 8);
+ assertEquals(8, e.getValue().get().length);
assertTrue(16 < encoder.decode(e.getValue().get()));
}
- assertTrue("size after keeping 3 versions was " + tmOut.size(), tmOut.size() == 6);
+ assertEquals("size after keeping 3 versions was " + tmOut.size(), 6, tmOut.size());
} catch (IOException e) {
- assertFalse(true);
+ fail();
} catch (Exception e) {
log.error("{}", e.getMessage(), e);
- assertFalse(true);
+ fail();
}
}
@@ -121,15 +123,15 @@ public class VersioningIteratorTest {
TreeMap<Key,Value> tmOut = iteratorOverTestData(it);
for (Entry<Key,Value> e : tmOut.entrySet()) {
- assertTrue(e.getValue().get().length == 8);
+ assertEquals(8, e.getValue().get().length);
assertTrue(16 < encoder.decode(e.getValue().get()));
}
- assertTrue("size after keeping 2 versions was " + tmOut.size(), tmOut.size() == 2);
+ assertEquals("size after keeping 2 versions was " + tmOut.size(), 2, tmOut.size());
} catch (IOException e) {
- assertFalse(true);
+ fail();
} catch (Exception e) {
log.error("{}", e.getMessage(), e);
- assertFalse(true);
+ fail();
}
}
@@ -155,11 +157,11 @@ public class VersioningIteratorTest {
TreeMap<Key,Value> tmOut = iteratorOverTestData(it);
for (Entry<Key,Value> e : tmOut.entrySet()) {
- assertTrue(e.getValue().get().length == 8);
+ assertEquals(8, e.getValue().get().length);
assertTrue(16 < encoder.decode(e.getValue().get()));
}
- assertTrue("size after seeking past versions was " + tmOut.size(), tmOut.size() == 0);
+ assertEquals("size after seeking past versions was " + tmOut.size(), 0, tmOut.size());
// after doing this seek, should get zero keys for row 0 and 3 keys for row 1
seekKey = new Key(new Text(String.format("%03d", 0)), colf, colq, 15);
@@ -168,17 +170,17 @@ public class VersioningIteratorTest {
tmOut = iteratorOverTestData(it);
for (Entry<Key,Value> e : tmOut.entrySet()) {
- assertTrue(e.getValue().get().length == 8);
+ assertEquals(8, e.getValue().get().length);
assertTrue(16 < encoder.decode(e.getValue().get()));
}
- assertTrue("size after seeking past versions was " + tmOut.size(), tmOut.size() == 3);
+ assertEquals("size after seeking past versions was " + tmOut.size(), 3, tmOut.size());
} catch (IOException e) {
- assertFalse(true);
+ fail();
} catch (Exception e) {
log.error("{}", e.getMessage(), e);
- assertFalse(true);
+ fail();
}
}
@@ -201,13 +203,13 @@ public class VersioningIteratorTest {
TreeMap<Key,Value> tmOut = iteratorOverTestData(it);
- assertTrue("size after keeping " + i + " versions was " + tmOut.size(),
- tmOut.size() == Math.min(40, 2 * i));
+ assertEquals("size after keeping " + i + " versions was " + tmOut.size(), tmOut.size(),
+ Math.min(40, 2 * i));
} catch (IOException e) {
- assertFalse(true);
+ fail();
} catch (Exception e) {
log.error("{}", e.getMessage(), e);
- assertFalse(true);
+ fail();
}
}
}
@@ -230,7 +232,7 @@ public class VersioningIteratorTest {
it.seek(new Range(seekKey, false, null, true), EMPTY_COL_FAMS, false);
assertTrue(it.hasTop());
- assertTrue(it.getTopKey().getTimestamp() == 18);
+ assertEquals(18, it.getTopKey().getTimestamp());
}
@@ -254,10 +256,10 @@ public class VersioningIteratorTest {
it2.seek(new Range(seekKey, false, null, true), EMPTY_COL_FAMS, false);
assertTrue(it.hasTop());
- assertTrue(it.getTopKey().getTimestamp() == 18);
+ assertEquals(18, it.getTopKey().getTimestamp());
assertTrue(it2.hasTop());
- assertTrue(it2.getTopKey().getTimestamp() == 18);
+ assertEquals(18, it2.getTopKey().getTimestamp());
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeColumnFamilyIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeColumnFamilyIteratorTest.java
index e016c69..5d0dd61 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeColumnFamilyIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeColumnFamilyIteratorTest.java
@@ -129,7 +129,7 @@ public class WholeColumnFamilyIteratorTest extends TestCase {
resultMap.putAll(WholeColumnFamilyIterator.decodeColumnFamily(rowKey, rowValue));
iter2.next();
}
- assertTrue(numRows == trueCount);
+ assertEquals(numRows, trueCount);
assertEquals(resultMap, map2);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeRowIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeRowIteratorTest.java
index 8aad1e3..6485b75 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeRowIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/WholeRowIteratorTest.java
@@ -106,7 +106,7 @@ public class WholeRowIteratorTest {
resultMap.putAll(WholeRowIterator.decodeRow(rowKey, rowValue));
iter.next();
}
- assertTrue(numRows == 5);
+ assertEquals(5, numRows);
assertEquals(resultMap, map);
WholeRowIterator iter2 = new WholeRowIterator(source) {
@@ -125,7 +125,7 @@ public class WholeRowIteratorTest {
resultMap.putAll(WholeRowIterator.decodeRow(rowKey, rowValue));
iter2.next();
}
- assertTrue(numRows == trueCount);
+ assertEquals(numRows, trueCount);
assertEquals(resultMap, map2);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java b/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
index 3479268..38173b4 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
@@ -20,6 +20,8 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -74,8 +76,8 @@ public class CredentialsTest {
} catch (Exception e) {
assertTrue(e instanceof RuntimeException);
assertTrue(e.getCause() instanceof AccumuloSecurityException);
- assertTrue(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode()
- .equals(SecurityErrorCode.TOKEN_EXPIRED));
+ assertEquals(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode(),
+ SecurityErrorCode.TOKEN_EXPIRED);
}
}
@@ -102,7 +104,7 @@ public class CredentialsTest {
inst.getConnector("testUser", testToken);
fail();
} catch (AccumuloSecurityException e) {
- assertTrue(e.getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
+ assertEquals(e.getSecurityErrorCode(), SecurityErrorCode.TOKEN_EXPIRED);
}
}
@@ -117,7 +119,7 @@ public class CredentialsTest {
assertEquals(0, nullNullCreds.hashCode());
assertEquals("abc".hashCode(), abcNullCreds.hashCode());
assertEquals(abcNullCreds.hashCode(), abcBlahCreds.hashCode());
- assertFalse(abcNullCreds.hashCode() == cbaNullCreds.hashCode());
+ assertNotEquals(abcNullCreds.hashCode(), cbaNullCreds.hashCode());
// identity
assertEquals(abcNullCreds, abcNullCreds);
@@ -126,9 +128,9 @@ public class CredentialsTest {
assertEquals(new Credentials("abc", new PasswordToken("abc".getBytes(UTF_8))),
new Credentials("abc", new PasswordToken("abc")));
// test not equals
- assertFalse(nullNullCreds.equals(abcBlahCreds));
- assertFalse(nullNullCreds.equals(abcNullCreds));
- assertFalse(abcNullCreds.equals(abcBlahCreds));
+ assertNotEquals(nullNullCreds, abcBlahCreds);
+ assertNotEquals(nullNullCreds, abcNullCreds);
+ assertNotEquals(abcNullCreds, abcBlahCreds);
}
@Test
@@ -143,8 +145,8 @@ public class CredentialsTest {
Credentials nullNullCreds = new Credentials(null, null);
serialized = nullNullCreds.serialize();
result = Credentials.deserialize(serialized);
- assertEquals(null, result.getPrincipal());
- assertEquals(null, result.getToken());
+ assertNull(result.getPrincipal());
+ assertNull(result.getToken());
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/util/PairTest.java b/core/src/test/java/org/apache/accumulo/core/util/PairTest.java
index cbf8862..e3d1764 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/PairTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/PairTest.java
@@ -17,10 +17,9 @@
package org.apache.accumulo.core.util;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.Map.Entry;
@@ -61,13 +60,13 @@ public class PairTest {
assertNotEquals(pair1, pair3);
// verify direct calls
- assertTrue(pair1.equals(pair2));
- assertTrue(pair2.equals(pair1));
- assertFalse(pair1.equals(pair3));
+ assertEquals(pair1, pair2);
+ assertEquals(pair2, pair1);
+ assertNotEquals(pair1, pair3);
// check null
assertEquals(null1, null1);
- assertEquals(null1, null);
+ assertNull(null1);
assertNotEquals(pair1, null1);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/util/TextUtilTest.java b/core/src/test/java/org/apache/accumulo/core/util/TextUtilTest.java
index be27d9a..e562150 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/TextUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/TextUtilTest.java
@@ -33,11 +33,11 @@ public class TextUtilTest extends TestCase {
String smallerMessage = "a";
Text smallerMessageText = new Text(smallerMessage);
Text someText = new Text(longMessage);
- assertTrue(someText.equals(longMessageText));
+ assertEquals(someText, longMessageText);
someText.set(smallerMessageText);
assertTrue(someText.getLength() != someText.getBytes().length);
- assertTrue(TextUtil.getBytes(someText).length == smallerMessage.length());
- assertTrue((new Text(TextUtil.getBytes(someText))).equals(smallerMessageText));
+ assertEquals(TextUtil.getBytes(someText).length, smallerMessage.length());
+ assertEquals((new Text(TextUtil.getBytes(someText))), smallerMessageText);
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/FormatterConfigTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/FormatterConfigTest.java
index 7975dc1..6d979e6 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/FormatterConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/FormatterConfigTest.java
@@ -17,8 +17,10 @@
package org.apache.accumulo.core.util.format;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.text.DateFormat;
@@ -30,8 +32,8 @@ public class FormatterConfigTest {
@Test
public void testConstructor() {
FormatterConfig config = new FormatterConfig();
- assertEquals(false, config.willLimitShowLength());
- assertEquals(false, config.willPrintTimestamps());
+ assertFalse(config.willLimitShowLength());
+ assertFalse(config.willPrintTimestamps());
}
@Test
@@ -44,23 +46,23 @@ public class FormatterConfigTest {
config.setShownLength(0);
assertEquals(0, config.getShownLength());
- assertEquals(true, config.willLimitShowLength());
+ assertTrue(config.willLimitShowLength());
config.setShownLength(1);
assertEquals(1, config.getShownLength());
- assertEquals(true, config.willLimitShowLength());
+ assertTrue(config.willLimitShowLength());
}
@Test
public void testDoNotLimitShowLength() {
FormatterConfig config = new FormatterConfig();
- assertEquals(false, config.willLimitShowLength());
+ assertFalse(config.willLimitShowLength());
config.setShownLength(1);
- assertEquals(true, config.willLimitShowLength());
+ assertTrue(config.willLimitShowLength());
config.doNotLimitShowLength();
- assertEquals(false, config.willLimitShowLength());
+ assertFalse(config.willLimitShowLength());
}
@Test
diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
index 30095b3..909f949 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
@@ -135,7 +135,7 @@ public class MiniAccumuloClusterTest {
} else if (entry.getKey().getColumnQualifierData().toString().equals("CRC")) {
Assert.assertEquals("123", entry.getValue().toString());
} else {
- Assert.assertTrue(false);
+ Assert.fail();
}
count++;
}
diff --git a/server/base/src/test/java/org/apache/accumulo/server/client/deprecated/BulkImporterTest.java b/server/base/src/test/java/org/apache/accumulo/server/client/deprecated/BulkImporterTest.java
index df9e1f6..713b883 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/client/deprecated/BulkImporterTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/client/deprecated/BulkImporterTest.java
@@ -182,11 +182,11 @@ public class BulkImporterTest {
// 1;2<
extent = new KeyExtent(Table.ID.of("1"), new Text("2"), null);
- Assert.assertEquals(null, BulkImporter.getStartRowForExtent(extent));
+ Assert.assertNull(BulkImporter.getStartRowForExtent(extent));
// 1<<
extent = new KeyExtent(Table.ID.of("1"), null, null);
- Assert.assertEquals(null, BulkImporter.getStartRowForExtent(extent));
+ Assert.assertNull(BulkImporter.getStartRowForExtent(extent));
// 1;8;7777777
extent = new KeyExtent(Table.ID.of("1"), new Text("8"), new Text("7777777"));
diff --git a/server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java b/server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
index 6f4564e..8b5e7b9 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
@@ -112,14 +112,14 @@ public class MetadataConstraintsTest {
violations = mc.check(null, m);
- assertEquals(null, violations);
+ assertNull(violations);
m = new Mutation(new Text("!0<"));
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.put(m, new Value("bar".getBytes()));
violations = mc.check(null, m);
- assertEquals(null, violations);
+ assertNull(violations);
m = new Mutation(new Text("!1<"));
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.put(m, new Value("bar".getBytes()));
diff --git a/server/base/src/test/java/org/apache/accumulo/server/fs/FileRefTest.java b/server/base/src/test/java/org/apache/accumulo/server/fs/FileRefTest.java
index 3e0868a..66f26ab 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/fs/FileRefTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/fs/FileRefTest.java
@@ -92,12 +92,12 @@ public class FileRefTest {
@Test
public void testCompareTo() {
- Assert.assertTrue(new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")
- .compareTo(new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")) == 0);
- Assert.assertTrue(new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")
- .compareTo(new FileRef("hdfs://nn1/accumulo/tables/2a/t-0003/C0004.rf")) == 0);
- Assert.assertTrue(new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")
- .compareTo(new FileRef("hdfs://nn1/accumulo/tables//2a/t-0003//C0004.rf")) == 0);
+ Assert.assertEquals(0, new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")
+ .compareTo(new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")));
+ Assert.assertEquals(0, new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")
+ .compareTo(new FileRef("hdfs://nn1/accumulo/tables/2a/t-0003/C0004.rf")));
+ Assert.assertEquals(0, new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")
+ .compareTo(new FileRef("hdfs://nn1/accumulo/tables//2a/t-0003//C0004.rf")));
Assert.assertTrue(new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0004.rf")
.compareTo(new FileRef("hdfs://1.2.3.4/accumulo/tables/2a/t-0003/C0005.rf")) < 0);
diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java
index 2dc25b5..d729620 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java
@@ -74,7 +74,7 @@ public class HostRegexTableLoadBalancerTest extends BaseHostRegexTableLoadBalanc
Assert.assertEquals(BAR.getTableName(), tids.get(BAR.getId()));
Assert.assertTrue(tids.containsKey(BAZ.getId()));
Assert.assertEquals(BAZ.getTableName(), tids.get(BAZ.getId()));
- Assert.assertEquals(false, this.isIpBasedRegex());
+ Assert.assertFalse(this.isIpBasedRegex());
}
@Test
diff --git a/server/base/src/test/java/org/apache/accumulo/server/problems/ProblemReportTest.java b/server/base/src/test/java/org/apache/accumulo/server/problems/ProblemReportTest.java
index 1f5a135..f75ae44 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/problems/ProblemReportTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/problems/ProblemReportTest.java
@@ -24,9 +24,9 @@ import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@@ -83,24 +83,24 @@ public class ProblemReportTest {
@Test
public void testEquals() {
r = new ProblemReport(TABLE_ID, ProblemType.FILE_READ, RESOURCE, SERVER, null);
- assertTrue(r.equals(r));
+ assertEquals(r, r);
ProblemReport r2 = new ProblemReport(TABLE_ID, ProblemType.FILE_READ, RESOURCE, SERVER, null);
- assertTrue(r.equals(r2));
- assertTrue(r2.equals(r));
+ assertEquals(r, r2);
+ assertEquals(r2, r);
ProblemReport rx1 = new ProblemReport(Table.ID.METADATA, ProblemType.FILE_READ, RESOURCE,
SERVER, null);
- assertFalse(r.equals(rx1));
+ assertNotEquals(r, rx1);
ProblemReport rx2 = new ProblemReport(TABLE_ID, ProblemType.FILE_WRITE, RESOURCE, SERVER, null);
- assertFalse(r.equals(rx2));
+ assertNotEquals(r, rx2);
ProblemReport rx3 = new ProblemReport(TABLE_ID, ProblemType.FILE_READ, RESOURCE + "x", SERVER,
null);
- assertFalse(r.equals(rx3));
+ assertNotEquals(r, rx3);
ProblemReport re1 = new ProblemReport(TABLE_ID, ProblemType.FILE_READ, RESOURCE, SERVER + "x",
null);
- assertTrue(r.equals(re1));
+ assertEquals(r, re1);
ProblemReport re2 = new ProblemReport(TABLE_ID, ProblemType.FILE_READ, RESOURCE, SERVER,
new IllegalArgumentException("yikes"));
- assertTrue(r.equals(re2));
+ assertEquals(r, re2);
}
@Test
diff --git a/server/base/src/test/java/org/apache/accumulo/server/replication/StatusCombinerTest.java b/server/base/src/test/java/org/apache/accumulo/server/replication/StatusCombinerTest.java
index f27c5f3..f4a915d 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/replication/StatusCombinerTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/replication/StatusCombinerTest.java
@@ -64,7 +64,7 @@ public class StatusCombinerTest {
// When combining only one message, we should get back the same instance
Status ret = combiner.typedReduce(key, Collections.singleton(status).iterator());
Assert.assertEquals(status, ret);
- Assert.assertTrue(status == ret);
+ Assert.assertSame(status, ret);
}
@Test
@@ -75,7 +75,7 @@ public class StatusCombinerTest {
Assert.assertEquals(10L, ret.getBegin());
Assert.assertEquals(20L, ret.getEnd());
Assert.assertEquals(100L, ret.getCreatedTime());
- Assert.assertEquals(false, ret.getClosed());
+ Assert.assertFalse(ret.getClosed());
}
@Test
@@ -86,7 +86,7 @@ public class StatusCombinerTest {
Assert.assertEquals(10L, ret.getBegin());
Assert.assertEquals(20L, ret.getEnd());
Assert.assertEquals(100L, ret.getCreatedTime());
- Assert.assertEquals(false, ret.getClosed());
+ Assert.assertFalse(ret.getClosed());
}
@Test
diff --git a/server/base/src/test/java/org/apache/accumulo/server/replication/proto/StatusTest.java b/server/base/src/test/java/org/apache/accumulo/server/replication/proto/StatusTest.java
index 297b9fc..306f718 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/replication/proto/StatusTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/replication/proto/StatusTest.java
@@ -27,7 +27,7 @@ public class StatusTest {
Status replicated = Status.newBuilder().setBegin(Long.MAX_VALUE).setEnd(0).setInfiniteEnd(true).setClosed(false).build();
Status unreplicated = Status.newBuilder().setBegin(0).setEnd(0).setInfiniteEnd(true).setClosed(false).build();
- Assert.assertFalse(replicated.equals(unreplicated));
+ Assert.assertNotEquals(replicated, unreplicated);
}
}
diff --git a/server/base/src/test/java/org/apache/accumulo/server/security/SystemCredentialsTest.java b/server/base/src/test/java/org/apache/accumulo/server/security/SystemCredentialsTest.java
index c53051e..45dff66 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/security/SystemCredentialsTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/security/SystemCredentialsTest.java
@@ -89,6 +89,6 @@ public class SystemCredentialsTest {
public void testSystemCredentials() {
Credentials a = SystemCredentials.get(inst);
Credentials b = SystemCredentials.get(inst);
- assertTrue(a.equals(b));
+ assertEquals(a, b);
}
}
diff --git a/server/base/src/test/java/org/apache/accumulo/server/security/handler/ZKAuthenticatorTest.java b/server/base/src/test/java/org/apache/accumulo/server/security/handler/ZKAuthenticatorTest.java
index f36a385..c0a6b5f 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/security/handler/ZKAuthenticatorTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/security/handler/ZKAuthenticatorTest.java
@@ -34,10 +34,10 @@ public class ZKAuthenticatorTest extends TestCase {
public void testPermissionIdConversions() {
for (SystemPermission s : SystemPermission.values())
- assertTrue(s.equals(SystemPermission.getPermissionById(s.getId())));
+ assertEquals(s, SystemPermission.getPermissionById(s.getId()));
for (TablePermission s : TablePermission.values())
- assertTrue(s.equals(TablePermission.getPermissionById(s.getId())));
+ assertEquals(s, TablePermission.getPermissionById(s.getId()));
}
public void testAuthorizationConversion() {
@@ -48,7 +48,7 @@ public class ZKAuthenticatorTest extends TestCase {
Authorizations converted = new Authorizations(auths);
byte[] test = ZKSecurityTool.convertAuthorizations(converted);
Authorizations test2 = ZKSecurityTool.convertAuthorizations(test);
- assertTrue(auths.size() == test2.size());
+ assertEquals(auths.size(), test2.size());
for (byte[] s : auths) {
assertTrue(test2.contains(s));
}
@@ -61,7 +61,7 @@ public class ZKAuthenticatorTest extends TestCase {
Set<SystemPermission> converted = ZKSecurityTool
.convertSystemPermissions(ZKSecurityTool.convertSystemPermissions(perms));
- assertTrue(perms.size() == converted.size());
+ assertEquals(perms.size(), converted.size());
for (SystemPermission s : perms)
assertTrue(converted.contains(s));
}
@@ -73,7 +73,7 @@ public class ZKAuthenticatorTest extends TestCase {
Set<TablePermission> converted = ZKSecurityTool
.convertTablePermissions(ZKSecurityTool.convertTablePermissions(perms));
- assertTrue(perms.size() == converted.size());
+ assertEquals(perms.size(), converted.size());
for (TablePermission s : perms)
assertTrue(converted.contains(s));
}
@@ -86,7 +86,7 @@ public class ZKAuthenticatorTest extends TestCase {
assertTrue(ZKSecurityTool.checkPass(rawPass, storedBytes));
} catch (AccumuloException e) {
log.error("{}", e.getMessage(), e);
- assertTrue(false);
+ fail();
}
}
}
diff --git a/server/base/src/test/java/org/apache/accumulo/server/util/TServerUtilsTest.java b/server/base/src/test/java/org/apache/accumulo/server/util/TServerUtilsTest.java
index a418f8b..1a377ed 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/util/TServerUtilsTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/util/TServerUtilsTest.java
@@ -303,7 +303,7 @@ public class TServerUtilsTest {
assertNotNull(address);
server = address.getServer();
assertNotNull(server);
- assertTrue(port[1] == address.getAddress().getPort());
+ assertEquals(port[1], address.getAddress().getPort());
} finally {
if (null != server) {
TServerUtils.stopTServer(server);
diff --git a/server/master/src/test/java/org/apache/accumulo/master/DefaultMapTest.java b/server/master/src/test/java/org/apache/accumulo/master/DefaultMapTest.java
index 8d139ac..9e15691 100644
--- a/server/master/src/test/java/org/apache/accumulo/master/DefaultMapTest.java
+++ b/server/master/src/test/java/org/apache/accumulo/master/DefaultMapTest.java
@@ -17,7 +17,7 @@
package org.apache.accumulo.master;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertSame;
import org.apache.accumulo.server.util.DefaultMap;
import org.junit.Test;
@@ -31,7 +31,7 @@ public class DefaultMapTest {
String empty = map.get("otherKey");
assertEquals(map.get("key"), "value");
assertEquals(empty, "");
- assertTrue(empty == map.get("otherKey"));
+ assertSame(empty, map.get("otherKey"));
}
}
diff --git a/server/monitor/src/test/java/org/apache/accumulo/monitor/util/AccumuloMonitorAppenderTest.java b/server/monitor/src/test/java/org/apache/accumulo/monitor/util/AccumuloMonitorAppenderTest.java
index 4b03abc..f915675 100644
--- a/server/monitor/src/test/java/org/apache/accumulo/monitor/util/AccumuloMonitorAppenderTest.java
+++ b/server/monitor/src/test/java/org/apache/accumulo/monitor/util/AccumuloMonitorAppenderTest.java
@@ -77,8 +77,8 @@ public class AccumuloMonitorAppenderTest {
executorService = appender.executorService;
// make sure executor service is started and running
- Assert.assertEquals(false, executorService.isShutdown());
- Assert.assertEquals(false, executorService.isTerminated());
+ Assert.assertFalse(executorService.isShutdown());
+ Assert.assertFalse(executorService.isTerminated());
// make sure executor service executes tasks
ScheduledFuture<Long> future = executorService.schedule(() -> counter.getAndIncrement(), 1,
@@ -90,13 +90,13 @@ public class AccumuloMonitorAppenderTest {
executorService.schedule(() -> counter.getAndIncrement(), 1, TimeUnit.DAYS);
// make sure executor service is still running
- Assert.assertEquals(false, executorService.isShutdown());
- Assert.assertEquals(false, executorService.isTerminated());
+ Assert.assertFalse(executorService.isShutdown());
+ Assert.assertFalse(executorService.isTerminated());
}
// verify that closing the appender shuts down the executor service threads
- Assert.assertEquals(true, executorService.isShutdown());
+ Assert.assertTrue(executorService.isShutdown());
executorService.awaitTermination(5, TimeUnit.SECONDS);
- Assert.assertEquals(true, executorService.isTerminated());
+ Assert.assertTrue(executorService.isTerminated());
// verify executor service did not wait for scheduled task to run
Assert.assertEquals(3, counter.get());
@@ -140,7 +140,7 @@ public class AccumuloMonitorAppenderTest {
parent.activateOptions();
// initially there are no appenders
- Assert.assertTrue(parent.getAllAppenders() == null);
+ Assert.assertNull(parent.getAllAppenders());
updateLocAndVerify(currentLoc, parent, 0);
updateLocAndVerify(currentLoc, parent, 10);
diff --git a/server/tracer/src/test/java/org/apache/accumulo/tracer/TracerTest.java b/server/tracer/src/test/java/org/apache/accumulo/tracer/TracerTest.java
index 65531e9..bfa0dca 100644
--- a/server/tracer/src/test/java/org/apache/accumulo/tracer/TracerTest.java
+++ b/server/tracer/src/test/java/org/apache/accumulo/tracer/TracerTest.java
@@ -108,11 +108,11 @@ public class TracerTest {
assertFalse(Trace.isTracing());
Trace.start("nop").stop();
- assertTrue(tracer.traces.size() == 0);
+ assertEquals(0, tracer.traces.size());
assertFalse(Trace.isTracing());
Trace.on("nop").stop();
- assertTrue(tracer.traces.size() == 1);
+ assertEquals(1, tracer.traces.size());
assertFalse(Trace.isTracing());
Span start = Trace.on("testing");
@@ -123,13 +123,13 @@ public class TracerTest {
span.stop();
long traceId = Trace.currentTraceId();
assertNotNull(tracer.traces.get(traceId));
- assertTrue(tracer.traces.get(traceId).size() == 1);
+ assertEquals(1, tracer.traces.get(traceId).size());
assertEquals("shortest trace ever", tracer.traces.get(traceId).get(0).description);
Span pause = Trace.start("pause");
Thread.sleep(100);
pause.stop();
- assertTrue(tracer.traces.get(traceId).size() == 2);
+ assertEquals(2, tracer.traces.get(traceId).size());
assertTrue(tracer.traces.get(traceId).get(1).millis() >= 100);
Thread t = new Thread(Trace.wrap(new Runnable() {
@@ -141,7 +141,7 @@ public class TracerTest {
t.start();
t.join();
- assertTrue(tracer.traces.get(traceId).size() == 3);
+ assertEquals(3, tracer.traces.get(traceId).size());
assertEquals("My Task", tracer.traces.get(traceId).get(2).description);
Trace.off();
assertFalse(Trace.isTracing());
@@ -189,7 +189,7 @@ public class TracerTest {
assertNotNull(tracer.traces.get(start.traceId()));
String traces[] = {"my test", "checkTrace", "client:checkTrace", "start"};
- assertTrue(tracer.traces.get(start.traceId()).size() == traces.length);
+ assertEquals(tracer.traces.get(start.traceId()).size(), traces.length);
for (int i = 0; i < traces.length; i++)
assertEquals(traces[i], tracer.traces.get(start.traceId()).get(i).description);
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
index 87b62fe..241a6d6 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
@@ -581,7 +581,7 @@ public class InMemoryMapTest {
SortedKeyValueIterator<Key,Value> dc1 = iter1.deepCopy(new SampleIE());
seekLocalityGroups(dc1);
- assertTrue(imm.getNumEntries() == 10);
+ assertEquals(10, imm.getNumEntries());
assertTrue(imm.estimatedSizeInBytes() > 0);
imm.delete(0);
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/TwoTierCompactionStrategyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/TwoTierCompactionStrategyTest.java
index 06a1e45..6aed0f4 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/TwoTierCompactionStrategyTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/TwoTierCompactionStrategyTest.java
@@ -77,7 +77,7 @@ public class TwoTierCompactionStrategyTest {
List<FileRef> filesToCompact = ttcs.getCompactionPlan(mcr).inputFiles;
Assert.assertEquals(fileMap.keySet(), new HashSet<>(filesToCompact));
Assert.assertEquals(8, filesToCompact.size());
- Assert.assertEquals(null, ttcs.getCompactionPlan(mcr).writeParameters.getCompressType());
+ Assert.assertNull(ttcs.getCompactionPlan(mcr).writeParameters.getCompressType());
}
@Test
@@ -105,9 +105,9 @@ public class TwoTierCompactionStrategyTest {
try {
opts.clear();
ttcs.init(opts);
- Assert.assertTrue("IllegalArgumentException should have been thrown.", false);
+ Assert.fail("IllegalArgumentException should have been thrown.");
} catch (IllegalArgumentException iae) {} catch (Throwable t) {
- Assert.assertTrue("IllegalArgumentException should have been thrown.", false);
+ Assert.fail("IllegalArgumentException should have been thrown.");
}
}
@@ -129,7 +129,7 @@ public class TwoTierCompactionStrategyTest {
List<FileRef> filesToCompact = ttcs.getCompactionPlan(mcr).inputFiles;
Assert.assertEquals(filesToCompactMap.keySet(), new HashSet<>(filesToCompact));
Assert.assertEquals(6, filesToCompact.size());
- Assert.assertEquals(null, ttcs.getCompactionPlan(mcr).writeParameters.getCompressType());
+ Assert.assertNull(ttcs.getCompactionPlan(mcr).writeParameters.getCompressType());
}
}
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java
index 0d42575..67c5807 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java
@@ -58,7 +58,7 @@ public class ConfigurableCompactionStrategyTest {
Assert.assertEquals(0, plan.writeParameters.getHdfsBlockSize());
Assert.assertEquals(0, plan.writeParameters.getIndexBlockSize());
Assert.assertEquals(0, plan.writeParameters.getReplication());
- Assert.assertEquals(null, plan.writeParameters.getCompressType());
+ Assert.assertNull(plan.writeParameters.getCompressType());
// test setting all output options
ccs = new ConfigurableCompactionStrategy();
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LogFileKeyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LogFileKeyTest.java
index 8965094..3c08f62 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LogFileKeyTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LogFileKeyTest.java
@@ -43,11 +43,11 @@ public class LogFileKeyTest {
LogFileKey mut = nk(LogEvents.MUTATION, 1, 3);
LogFileKey mmut = nk(LogEvents.MANY_MUTATIONS, 1, 3);
- Assert.assertTrue(start.compareTo(finish) == 0);
- Assert.assertTrue(finish.compareTo(start) == 0);
+ Assert.assertEquals(0, start.compareTo(finish));
+ Assert.assertEquals(0, finish.compareTo(start));
- Assert.assertTrue(mut.compareTo(mmut) == 0);
- Assert.assertTrue(mmut.compareTo(mut) == 0);
+ Assert.assertEquals(0, mut.compareTo(mmut));
+ Assert.assertEquals(0, mmut.compareTo(mut));
}
@Test
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/logger/LogFileTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/logger/LogFileTest.java
index 22c83cc..63f1b05 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/logger/LogFileTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/logger/LogFileTest.java
@@ -61,9 +61,9 @@ public class LogFileTest {
in.reset(out.getData(), out.size());
keyResult.readFields(in);
valueResult.readFields(in);
- assertTrue(key.compareTo(keyResult) == 0);
+ assertEquals(0, key.compareTo(keyResult));
assertEquals(value.mutations, valueResult.mutations);
- assertTrue(in.read() == -1);
+ assertEquals(in.read(), -1);
}
@Test
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/DatafileManagerTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/DatafileManagerTest.java
index bcd2d05..3c8f28d 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/DatafileManagerTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/DatafileManagerTest.java
@@ -17,6 +17,7 @@
package org.apache.accumulo.tserver.tablet;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import java.io.IOException;
import java.util.SortedMap;
@@ -80,7 +81,7 @@ public class DatafileManagerTest {
EasyMock.verify(tablet, tableConf);
- assertEquals(null, mergeFile);
+ assertNull(mergeFile);
}
/*
@@ -98,7 +99,7 @@ public class DatafileManagerTest {
EasyMock.verify(tablet, tableConf);
- assertEquals(null, mergeFile);
+ assertNull(mergeFile);
}
/*
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
index 92568c9..81ea37f 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
@@ -132,8 +132,8 @@ public class AccumuloReloadingVFSClassLoaderTest {
Assert.assertEquals("Hello World!", o2.toString());
// This is false because they are loaded by a different classloader
- Assert.assertFalse(clazz1.equals(clazz2));
- Assert.assertFalse(o1.equals(o2));
+ Assert.assertNotEquals(clazz1, clazz2);
+ Assert.assertNotEquals(o1, o2);
arvcl.close();
}
@@ -236,8 +236,8 @@ public class AccumuloReloadingVFSClassLoaderTest {
Assert.assertEquals("Hello World!", o2.toString());
// This is false because they are loaded by a different classloader
- Assert.assertFalse(clazz1.equals(clazz2));
- Assert.assertFalse(o1.equals(o2));
+ Assert.assertNotEquals(clazz1, clazz2);
+ Assert.assertNotEquals(o1, o2);
arvcl.close();
}
@@ -289,8 +289,8 @@ public class AccumuloReloadingVFSClassLoaderTest {
Assert.assertEquals("Hallo Welt", o2.toString());
// This is false because they are loaded by a different classloader
- Assert.assertFalse(clazz1.equals(clazz2));
- Assert.assertFalse(o1.equals(o2));
+ Assert.assertNotEquals(clazz1, clazz2);
+ Assert.assertNotEquals(o1, o2);
Class<?> clazz3 = loader1.loadClass("test.HelloWorld");
Object o3 = clazz3.newInstance();
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
index 8d70f31..bc066c5 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
@@ -170,7 +170,7 @@ public class AccumuloVFSClassLoaderTest {
javaIoTmpDir = javaIoTmpDir.substring(0, javaIoTmpDir.length() - File.separator.length());
}
- Assert.assertTrue(javaIoTmpDir.equals(tempDirParent));
+ Assert.assertEquals(javaIoTmpDir, tempDirParent);
Assert.assertTrue(tempDirName.startsWith("accumulo-vfs-cache-"));
Assert.assertTrue(tempDirName.endsWith(System.getProperty("user.name", "nouser")));
@@ -208,7 +208,7 @@ public class AccumuloVFSClassLoaderTest {
File tempDir = Whitebox.getInternalState(replicator, "tempDir");
String tempDirParent = tempDir.getParent();
String tempDirName = tempDir.getName();
- Assert.assertTrue(cacheDir.equals(tempDirParent));
+ Assert.assertEquals(cacheDir, tempDirParent);
Assert.assertTrue(tempDirName.startsWith("accumulo-vfs-cache-"));
Assert.assertTrue(tempDirName.endsWith(System.getProperty("user.name", "nouser")));
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
index 44db338..221fc5c 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
@@ -122,7 +122,7 @@ public class ContextManagerTest {
Object o2 = myContextClass.newInstance();
Assert.assertEquals("Hello World!", o2.toString());
- Assert.assertFalse(defaultContextClass.equals(myContextClass));
+ Assert.assertNotEquals(defaultContextClass, myContextClass);
cm.removeUnusedContexts(new HashSet<>());
}
@@ -152,8 +152,8 @@ public class ContextManagerTest {
}
});
- Assert.assertTrue(cm.getClassLoader("CX1").loadClass("test.HelloWorld") == pclass);
- Assert.assertFalse(cm.getClassLoader("CX2").loadClass("test.HelloWorld") == pclass);
+ Assert.assertSame(cm.getClassLoader("CX1").loadClass("test.HelloWorld"), pclass);
+ Assert.assertNotSame(cm.getClassLoader("CX2").loadClass("test.HelloWorld"), pclass);
}
@After
diff --git a/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java b/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java
index e3ed95a..6a11f90 100644
--- a/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java
@@ -17,6 +17,7 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;
@@ -95,7 +96,7 @@ public class BalanceFasterIT extends ConfigurableMacBase {
}
// should be on all three servers
- assertTrue(counts.size() == 3);
+ assertEquals(3, counts.size());
// and distributed evenly
i = counts.values().iterator();
}
diff --git a/test/src/main/java/org/apache/accumulo/test/CloneIT.java b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
index 5a30b9d..0c4c6a9 100644
--- a/test/src/main/java/org/apache/accumulo/test/CloneIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
@@ -18,6 +18,7 @@ package org.apache.accumulo.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.HashSet;
import java.util.Map.Entry;
@@ -387,7 +388,7 @@ public class CloneIT extends AccumuloClusterHarness {
try {
MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), conn, bw2);
- assertTrue(false);
+ fail();
} catch (TabletIterator.TabletDeletedException tde) {}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
index 90ce4e1..0214e3a 100644
--- a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
@@ -68,7 +68,7 @@ public class LocatorIT extends AccumuloClusterHarness {
String location = locations.getTabletLocation(tid);
Assert.assertNotNull("Location for " + tid + " was null", location);
Assert.assertTrue("Unknown location " + location, tservers.contains(location));
- Assert.assertTrue("Expected <host>:<port> " + location, location.split(":").length == 2);
+ Assert.assertEquals("Expected <host>:<port> " + location, 2, location.split(":").length);
}
diff --git a/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java b/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
index ea4b78d..1e4b4ef 100644
--- a/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
@@ -810,10 +810,10 @@ public class NewTableConfigurationIT extends SharedMiniClusterBase {
for (Entry<String,String> entry : connector.tableOperations().getProperties(tableName)) {
if (entry.getKey().equals(Property.TABLE_SPLIT_THRESHOLD.getKey()))
- Assert.assertTrue("TABLE_SPLIT_THRESHOLD has been changed", entry.getValue().equals("10K"));
+ Assert.assertEquals("TABLE_SPLIT_THRESHOLD has been changed", "10K", entry.getValue());
if (entry.getKey().equals("table.custom.testProp"))
- Assert.assertTrue("table.custom.testProp has been changed",
- entry.getValue().equals("Test property"));
+ Assert.assertEquals("table.custom.testProp has been changed", "Test property",
+ entry.getValue());
}
Assert.assertEquals("Extra properties using the new create method", countOrig + 1, countNew);
diff --git a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
index 41ba8a3..410799b 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
@@ -449,7 +449,7 @@ public class ShellServerIT extends SharedMiniClusterBase {
ts.exec("createtable " + table);
make10();
String lines = ts.exec("egrep row[123]", true);
- assertTrue(lines.split("\n").length - 1 == 3);
+ assertEquals(3, lines.split("\n").length - 1);
ts.exec("deletetable -f " + table);
}
@@ -856,15 +856,14 @@ public class ShellServerIT extends SharedMiniClusterBase {
Connector connector = getConnector();
for (Entry<String,String> entry : connector.tableOperations().getProperties(table)) {
if (entry.getKey().equals("table.custom.description"))
- Assert.assertTrue("Initial property was not set correctly",
- entry.getValue().equals("description"));
+ Assert.assertEquals("Initial property was not set correctly", "description",
+ entry.getValue());
if (entry.getKey().equals("table.custom.testProp"))
- Assert.assertTrue("Initial property was not set correctly",
- entry.getValue().equals("testProp"));
+ Assert.assertEquals("Initial property was not set correctly", "testProp", entry.getValue());
if (entry.getKey().equals(Property.TABLE_SPLIT_THRESHOLD.getKey()))
- Assert.assertTrue("Initial property was not set correctly", entry.getValue().equals("10K"));
+ Assert.assertEquals("Initial property was not set correctly", "10K", entry.getValue());
}
ts.exec("deletetable -f " + table);
@@ -2142,7 +2141,7 @@ public class ShellServerIT extends SharedMiniClusterBase {
Map<String,Set<Text>> lMap = connector.tableOperations().getLocalityGroups(table);
Set<Text> expectedColFams = new HashSet<>(Arrays.asList(new Text("fam1"), new Text("fam2")));
for (Entry<String,Set<Text>> entry : lMap.entrySet()) {
- Assert.assertTrue(entry.getKey().equals("locg1"));
+ Assert.assertEquals("locg1", entry.getKey());
Assert.assertTrue(entry.getValue().containsAll(expectedColFams));
}
ts.exec("deletetable -f " + table);
diff --git a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
index fd42199..28f51fd 100644
--- a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -329,7 +329,7 @@ public class TableOperationsIT extends AccumuloClusterHarness {
switch (actual.size()) {
case 3:
// Compaction cancel didn't happen in time
- assertTrue(HardListIterator.allEntriesToInject.equals(actual));
+ assertEquals(HardListIterator.allEntriesToInject, actual);
break;
case 2:
// Compacted the first tablet (-inf, f)
diff --git a/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java b/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
index b465d4a..e8dee5e 100644
--- a/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
@@ -17,9 +17,9 @@
package org.apache.accumulo.test;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
import java.util.ArrayList;
@@ -100,7 +100,7 @@ public class TransportCachingIT extends AccumuloClusterHarness {
}
// We should get the same transport
- assertTrue("Expected the first and second to be the same instance", first == second);
+ assertSame("Expected the first and second to be the same instance", first, second);
// Return the 2nd
pool.returnTransport(second);
@@ -114,7 +114,7 @@ public class TransportCachingIT extends AccumuloClusterHarness {
}
}
- assertFalse("Expected second and third transport to be different instances", second == third);
+ assertNotSame("Expected second and third transport to be different instances", second, third);
pool.returnTransport(third);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/UsersIT.java b/test/src/main/java/org/apache/accumulo/test/UsersIT.java
index e5cad65..b3385b5 100644
--- a/test/src/main/java/org/apache/accumulo/test/UsersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UsersIT.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.test;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -51,8 +52,8 @@ public class UsersIT extends AccumuloClusterHarness {
new PasswordToken("better_fail"));
fail("Creating a user that already exists should throw an exception");
} catch (AccumuloSecurityException e) {
- assertTrue("Expected USER_EXISTS error",
- SecurityErrorCode.USER_EXISTS == e.getSecurityErrorCode());
+ assertSame("Expected USER_EXISTS error", SecurityErrorCode.USER_EXISTS,
+ e.getSecurityErrorCode());
String msg = e.getMessage();
assertTrue("Error message didn't contain principal: '" + msg + "'",
msg.contains(user0.getPrincipal()));
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
index 718b438..3177a20 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.test.functional;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -95,7 +96,7 @@ public class CredentialsIT extends AccumuloClusterHarness {
inst.getConnector("non_existent_user", token);
fail();
} catch (AccumuloSecurityException e) {
- assertTrue(e.getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
+ assertEquals(e.getSecurityErrorCode(), SecurityErrorCode.TOKEN_EXPIRED);
}
}
@@ -115,8 +116,8 @@ public class CredentialsIT extends AccumuloClusterHarness {
} catch (Exception e) {
assertTrue(e instanceof RuntimeException);
assertTrue(e.getCause() instanceof AccumuloSecurityException);
- assertTrue(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode()
- .equals(SecurityErrorCode.TOKEN_EXPIRED));
+ assertEquals(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode(),
+ SecurityErrorCode.TOKEN_EXPIRED);
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
index 2b544e8..3c311f5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
@@ -172,7 +172,7 @@ public class DurabilityIT extends ConfigurableMacBase {
c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), "sync");
writeSome(tableName, N);
restartTServer();
- assertTrue(N == readSome(tableName));
+ assertEquals(N, readSome(tableName));
}
private static Map<String,String> map(Iterable<Entry<String,String>> entries) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/NativeMapIT.java b/test/src/main/java/org/apache/accumulo/test/functional/NativeMapIT.java
index 791120c..0cbbe02 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/NativeMapIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/NativeMapIT.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
@@ -267,42 +268,42 @@ public class NativeMapIT {
try {
nm.put(newKey(1), newValue(1));
- assertTrue(false);
+ fail();
} catch (IllegalStateException e) {
}
try {
nm.get(newKey(1));
- assertTrue(false);
+ fail();
} catch (IllegalStateException e) {
}
try {
nm.iterator();
- assertTrue(false);
+ fail();
} catch (IllegalStateException e) {
}
try {
nm.iterator(newKey(1));
- assertTrue(false);
+ fail();
} catch (IllegalStateException e) {
}
try {
nm.size();
- assertTrue(false);
+ fail();
} catch (IllegalStateException e) {
}
try {
iter.next();
- assertTrue(false);
+ fail();
} catch (IllegalStateException e) {
}
@@ -319,7 +320,7 @@ public class NativeMapIT {
try {
nm.delete();
- assertTrue(false);
+ fail();
} catch (IllegalStateException e) {
}
@@ -365,7 +366,7 @@ public class NativeMapIT {
try {
iter.next();
- assertTrue(false);
+ fail();
} catch (NoSuchElementException e) {
}
@@ -377,7 +378,7 @@ public class NativeMapIT {
try {
iter.next();
- assertTrue(false);
+ fail();
} catch (NoSuchElementException e) {
}
@@ -587,8 +588,8 @@ public class NativeMapIT {
public void testEmpty() {
NativeMap nm = new NativeMap();
- assertTrue(nm.size() == 0);
- assertTrue(nm.getMemoryUsed() == 0);
+ assertEquals(0, nm.size());
+ assertEquals(0, nm.getMemoryUsed());
nm.delete();
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ShutdownIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ShutdownIT.java
index aa6bcf2..53968ff 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ShutdownIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ShutdownIT.java
@@ -18,7 +18,7 @@ package org.apache.accumulo.test.functional;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import java.io.IOException;
import java.util.List;
@@ -118,7 +118,7 @@ public class ShutdownIT extends ConfigurableMacBase {
assertEquals(0, cluster.exec(Admin.class, "stop", doomed).waitFor());
tabletServers = c.instanceOperations().getTabletServers();
assertEquals(1, tabletServers.size());
- assertFalse(tabletServers.get(0).equals(doomed));
+ assertNotEquals(tabletServers.get(0), doomed);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloRowInputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloRowInputFormatIT.java
index a66cd18..34ae0d1 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloRowInputFormatIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloRowInputFormatIT.java
@@ -18,7 +18,7 @@ package org.apache.accumulo.test.mapred;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
@@ -125,7 +125,7 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
checkLists(row3, v);
break;
default:
- assertTrue(false);
+ fail();
}
} catch (AssertionError e) {
e1 = e;
diff --git a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloFileOutputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloFileOutputFormatIT.java
index 5e0d999..16a0857 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloFileOutputFormatIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloFileOutputFormatIT.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.test.mapreduce;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
@@ -122,7 +123,7 @@ public class AccumuloFileOutputFormatIT extends AccumuloClusterHarness {
try {
context.write(key, value);
if (index == 2)
- assertTrue(false);
+ fail();
} catch (Exception e) {
assertEquals(2, index);
}
diff --git a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloRowInputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloRowInputFormatIT.java
index 954b27a..d579264 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloRowInputFormatIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloRowInputFormatIT.java
@@ -18,7 +18,7 @@ package org.apache.accumulo.test.mapreduce;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
@@ -121,7 +121,7 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
checkLists(row3, v);
break;
default:
- assertTrue(false);
+ fail();
}
} catch (AssertionError e) {
e1 = e;
diff --git a/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java b/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java
index dbcbbf8..ea8f8f4 100644
--- a/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java
+++ b/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -1302,8 +1303,8 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase {
map = client.tableIdMap(creds);
assertEquals(map.get("slow"), scan.getExtent().tableId);
- assertTrue(scan.getExtent().endRow == null);
- assertTrue(scan.getExtent().prevEndRow == null);
+ assertNull(scan.getExtent().endRow);
+ assertNull(scan.getExtent().prevEndRow);
found = true;
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyTableOperations.java b/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyTableOperations.java
index 9858844..fbd07c7 100644
--- a/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyTableOperations.java
+++ b/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyTableOperations.java
@@ -119,7 +119,7 @@ public class TestProxyTableOperations {
for (ByteBuffer split : tableSplits)
assertTrue(splits.contains(split));
- assertTrue(tableSplits.size() == splits.size());
+ assertEquals(tableSplits.size(), splits.size());
}
@@ -135,7 +135,7 @@ public class TestProxyTableOperations {
for (ByteBuffer split : tableSplits)
assertTrue(splits.contains(split));
- assertTrue(tableSplits.size() == splits.size());
+ assertEquals(tableSplits.size(), splits.size());
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
index 7a5bac5..8bc8590 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
@@ -226,7 +226,7 @@ public class GarbageCollectorCommunicatesWithTServersIT extends ConfigurableMacB
Status status = fileToStatus.get(walName);
- Assert.assertEquals("Expected Status for file to not be closed", false, status.getClosed());
+ Assert.assertFalse("Expected Status for file to not be closed", status.getClosed());
Set<String> filesForTable = getFilesForTable(table);
Assert.assertEquals("Expected to only find one rfile for table", 1, filesForTable.size());
@@ -318,7 +318,7 @@ public class GarbageCollectorCommunicatesWithTServersIT extends ConfigurableMacB
Status status = fileToStatus.get(walName);
- Assert.assertEquals("Expected Status for file to not be closed", false, status.getClosed());
+ Assert.assertFalse("Expected Status for file to not be closed", status.getClosed());
Set<String> filesForTable = getFilesForTable(table);
Assert.assertEquals("Expected to only find one rfile for table", 1, filesForTable.size());
--
To stop receiving notification emails like this one, please contact
ctubbsii@apache.org.