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 2022/02/21 09:15:53 UTC
[accumulo] branch main updated: Migrate accumulo-core module from JUnit 4 to JUnit 5 (#2427)
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 78a1425 Migrate accumulo-core module from JUnit 4 to JUnit 5 (#2427)
78a1425 is described below
commit 78a1425ded5725d4d0c40fe85664fa97ceb15184
Author: Dom G <do...@gmail.com>
AuthorDate: Mon Feb 21 04:15:45 2022 -0500
Migrate accumulo-core module from JUnit 4 to JUnit 5 (#2427)
* Replace JUnit4 dependancy with JUnit5 and junit-vintage-engine throughout
* Convert accumulo-core module to use the new JUnit5 API
* Update dependency analyzer config
* Create WithTestNames parent class for core module unit tests to
consolidate the test name lookup into a single location
* Remove unneeded TODO about having JUnit as a dependency for the
iterator test harness
Co-authored-by: Christopher Tubbs <ct...@apache.org>
---
core/pom.xml | 10 +-
.../ByteSequenceTest.java => WithTestNames.java} | 31 +++--
.../classloader/ContextClassLoaderFactoryTest.java | 33 +++---
.../accumulo/core/cli/PasswordConverterTest.java | 18 +--
.../apache/accumulo/core/cli/TestClientOpts.java | 6 +-
.../org/apache/accumulo/core/cli/TestHelp.java | 4 +-
.../core/client/BatchWriterConfigTest.java | 8 +-
.../core/client/ClientConfigurationTest.java | 14 +--
.../accumulo/core/client/ClientPropertiesTest.java | 6 +-
.../accumulo/core/client/IteratorSettingTest.java | 8 +-
.../accumulo/core/client/RowIteratorTest.java | 10 +-
.../accumulo/core/client/TestThrift1474.java | 8 +-
.../core/client/ZooKeeperInstanceTest.java | 10 +-
.../client/admin/DelegationTokenConfigTest.java | 6 +-
.../client/admin/NewTableConfigurationTest.java | 12 +-
.../client/lexicoder/BigIntegerLexicoderTest.java | 2 +-
.../core/client/lexicoder/BytesLexicoderTest.java | 2 +-
.../core/client/lexicoder/DateLexicoderTest.java | 2 +-
.../core/client/lexicoder/DoubleLexicoderTest.java | 2 +-
.../core/client/lexicoder/FloatLexicoderTest.java | 2 +-
.../client/lexicoder/IntegerLexicoderTest.java | 2 +-
.../core/client/lexicoder/LexicoderTest.java | 2 +-
.../core/client/lexicoder/ListLexicoderTest.java | 10 +-
.../core/client/lexicoder/LongLexicoderTest.java | 2 +-
.../core/client/lexicoder/PairLexicoderTest.java | 2 +-
.../client/lexicoder/ReverseLexicoderTest.java | 2 +-
.../client/lexicoder/SequenceLexicoderTest.java | 6 +-
.../core/client/lexicoder/StringLexicoderTest.java | 2 +-
.../core/client/lexicoder/TextLexicoderTest.java | 2 +-
.../client/lexicoder/UIntegerLexicoderTest.java | 2 +-
.../core/client/lexicoder/ULongLexicoderTest.java | 2 +-
.../core/client/lexicoder/UUIDLexicoderTest.java | 2 +-
.../mapred/AccumuloFileOutputFormatTest.java | 4 +-
.../client/mapred/AccumuloInputFormatTest.java | 13 +--
.../mapred/AccumuloMultiTableInputFormatTest.java | 16 +--
.../client/mapred/AccumuloOutputFormatTest.java | 6 +-
.../core/client/mapred/RangeInputSplitTest.java | 8 +-
.../mapreduce/AccumuloFileOutputFormatTest.java | 4 +-
.../client/mapreduce/AccumuloInputFormatTest.java | 4 +-
.../AccumuloMultiTableInputFormatTest.java | 16 +--
.../client/mapreduce/AccumuloOutputFormatTest.java | 6 +-
.../client/mapreduce/InputTableConfigTest.java | 8 +-
.../core/client/mapreduce/RangeInputSplitTest.java | 8 +-
.../lib/partition/RangePartitionerTest.java | 6 +-
.../core/client/rfile/RFileClientTest.java | 12 +-
.../client/security/SecurityErrorCodeTest.java | 4 +-
.../tokens/CredentialProviderTokenTest.java | 14 +--
.../security/tokens/DelegationTokenImplTest.java | 6 +-
.../client/security/tokens/KerberosTokenTest.java | 4 +-
.../client/security/tokens/PasswordTokenTest.java | 6 +-
.../client/summary/CountingSummarizerTest.java | 4 +-
.../summarizers/AuthorizationSummarizerTest.java | 4 +-
.../summarizers/EntryLengthSummarizersTest.java | 4 +-
.../core/clientImpl/ClientConfConverterTest.java | 4 +-
.../core/clientImpl/ClientContextTest.java | 14 +--
.../core/clientImpl/ConditionalComparatorTest.java | 6 +-
.../DelegationTokenConfigSerializerTest.java | 4 +-
.../core/clientImpl/RootTabletLocatorTest.java | 6 +-
.../accumulo/core/clientImpl/ScannerBaseTest.java | 4 +-
.../accumulo/core/clientImpl/ScannerImplTest.java | 10 +-
.../core/clientImpl/ScannerOptionsTest.java | 6 +-
.../core/clientImpl/TableOperationsHelperTest.java | 10 +-
.../core/clientImpl/TabletLocatorImplTest.java | 16 +--
.../clientImpl/TabletServerBatchReaderTest.java | 10 +-
.../core/clientImpl/ThriftScannerTest.java | 12 +-
.../core/clientImpl/ThriftTransportKeyTest.java | 14 +--
.../core/clientImpl/ZookeeperLockCheckerTest.java | 6 +-
.../bulk/BulkImportFilterInvalidTest.java | 14 +--
.../core/clientImpl/bulk/BulkImportTest.java | 6 +-
.../core/clientImpl/bulk/BulkSerializeTest.java | 8 +-
.../bulk/ConcurrentKeyExtentCacheTest.java | 10 +-
.../lexicoder/AbstractLexicoderTest.java | 25 ++--
.../core/clientImpl/lexicoder/ByteUtilsTest.java | 8 +-
.../clientImpl/mapreduce/BatchInputSplitTest.java | 8 +-
.../mapreduce/lib/ConfiguratorBaseTest.java | 10 +-
.../core/conf/AccumuloConfigurationTest.java | 16 +--
.../accumulo/core/conf/ClientPropertyTest.java | 8 +-
.../accumulo/core/conf/ConfigCheckUtilTest.java | 8 +-
.../core/conf/ConfigurationTypeHelperTest.java | 6 +-
.../core/conf/DefaultConfigurationTest.java | 12 +-
.../core/conf/DeprecatedPropertyUtilTest.java | 18 +--
.../core/conf/HadoopCredentialProviderTest.java | 20 ++--
.../accumulo/core/conf/IterConfigUtilTest.java | 8 +-
.../apache/accumulo/core/conf/PropertyTest.java | 37 +++---
.../accumulo/core/conf/PropertyTypeTest.java | 43 +++----
.../accumulo/core/conf/SiteConfigurationTest.java | 8 +-
.../core/conf/cluster/ClusterConfigParserTest.java | 12 +-
.../constraints/DefaultKeySizeConstraintTest.java | 4 +-
.../DeprecatedConstraintExtendTest.java | 4 +-
.../core/constraints/NoDeleteConstraintTest.java | 6 +-
.../core/constraints/VisibilityConstraintTest.java | 20 ++--
.../accumulo/core/crypto/BlockedIOStreamTest.java | 6 +-
.../apache/accumulo/core/crypto/CryptoTest.java | 18 +--
.../accumulo/core/data/ArrayByteSequenceTest.java | 14 +--
.../accumulo/core/data/ByteSequenceTest.java | 4 +-
.../org/apache/accumulo/core/data/ColumnTest.java | 14 +--
.../apache/accumulo/core/data/ConditionTest.java | 16 +--
.../core/data/ConditionalMutationTest.java | 16 +--
.../core/data/ConstraintViolationSummaryTest.java | 4 +-
.../apache/accumulo/core/data/KeyBuilderTest.java | 8 +-
.../apache/accumulo/core/data/KeyExtentTest.java | 10 +-
.../org/apache/accumulo/core/data/KeyTest.java | 14 +--
.../apache/accumulo/core/data/LoadPlanTest.java | 6 +-
.../apache/accumulo/core/data/MutationTest.java | 14 +--
.../apache/accumulo/core/data/NamespaceIdTest.java | 26 ++---
.../org/apache/accumulo/core/data/RangeTest.java | 22 ++--
.../org/apache/accumulo/core/data/TableIdTest.java | 28 +++--
.../org/apache/accumulo/core/data/ValueTest.java | 20 ++--
.../constraints/DefaultKeySizeConstraintTest.java | 4 +-
.../data/constraints/NoDeleteConstraintTest.java | 6 +-
.../data/constraints/VisibilityConstraintTest.java | 20 ++--
.../core/file/BloomFilterLayerLookupTest.java | 22 ++--
.../accumulo/core/file/FileOperationsTest.java | 6 +-
.../blockfile/cache/BlockCacheFactoryTest.java | 4 +-
.../blockfile/cache/BlockCacheManagerTest.java | 4 +-
.../file/blockfile/cache/TestCachedBlockQueue.java | 4 +-
.../file/blockfile/cache/TestLruBlockCache.java | 12 +-
.../accumulo/core/file/rfile/BlockIndexTest.java | 8 +-
.../core/file/rfile/GenerateSplitsTest.java | 42 +++----
.../accumulo/core/file/rfile/KeyShortenerTest.java | 6 +-
.../core/file/rfile/MultiLevelIndexTest.java | 6 +-
.../core/file/rfile/MultiThreadedRFileTest.java | 52 ++++-----
.../accumulo/core/file/rfile/RFileMetricsTest.java | 19 +--
.../apache/accumulo/core/file/rfile/RFileTest.java | 31 +++--
.../accumulo/core/file/rfile/RelativeKeyTest.java | 14 +--
.../accumulo/core/file/rfile/RollingStatsTest.java | 8 +-
.../core/file/rfile/bcfile/CompressionTest.java | 68 ++++++-----
.../file/streams/RateLimitedInputStreamTest.java | 4 +-
.../file/streams/RateLimitedOutputStreamTest.java | 4 +-
.../iterators/FirstEntryInRowIteratorTest.java | 6 +-
.../core/iterators/FirstEntryInRowTest.java | 8 +-
.../core/iterators/SortedMapIteratorTest.java | 4 +-
.../system/ColumnFamilySkippingIteratorTest.java | 8 +-
.../core/iterators/system/ColumnFilterTest.java | 10 +-
.../iterators/system/DeletingIteratorTest.java | 18 +--
.../core/iterators/system/MultiIteratorTest.java | 15 +--
.../system/SourceSwitchingIteratorTest.java | 12 +-
.../iterators/system/TimeSettingIteratorTest.java | 12 +-
.../iterators/system/VisibilityFilterTest.java | 8 +-
.../iterators/user/BigDecimalCombinerTest.java | 12 +-
.../core/iterators/user/ColumnSliceFilterTest.java | 14 +--
.../accumulo/core/iterators/user/CombinerTest.java | 14 +--
.../accumulo/core/iterators/user/FilterTest.java | 8 +-
.../core/iterators/user/GrepIteratorTest.java | 12 +-
.../iterators/user/IndexedDocIteratorTest.java | 6 +-
.../iterators/user/IntersectingIteratorTest.java | 11 +-
.../core/iterators/user/LargeRowFilterTest.java | 6 +-
.../core/iterators/user/RegExFilterTest.java | 10 +-
.../iterators/user/RowDeletingIteratorTest.java | 8 +-
.../iterators/user/RowEncodingIteratorTest.java | 10 +-
.../core/iterators/user/RowFilterTest.java | 12 +-
.../core/iterators/user/TestCfCqSlice.java | 129 ++++++++++-----------
.../iterators/user/TransformingIteratorTest.java | 26 ++---
.../iterators/user/VersioningIteratorTest.java | 24 ++--
.../core/iterators/user/VisibilityFilterTest.java | 4 +-
.../user/WholeColumnFamilyIteratorTest.java | 8 +-
.../core/iterators/user/WholeRowIteratorTest.java | 10 +-
.../core/metadata/MetadataServicerTest.java | 14 +--
.../core/metadata/schema/DeleteMetadataTest.java | 4 +-
.../core/metadata/schema/LinkingIteratorTest.java | 6 +-
.../core/metadata/schema/MetadataSchemaTest.java | 6 +-
.../core/metadata/schema/MetadataTimeTest.java | 10 +-
.../core/metadata/schema/SortSkewTest.java | 6 +-
.../core/metadata/schema/TabletFileTest.java | 37 +++---
.../core/metadata/schema/TabletMetadataTest.java | 12 +-
.../ReplicationConfigurationUtilTest.java | 35 +++---
.../core/replication/ReplicationSchemaTest.java | 6 +-
.../core/replication/ReplicationTargetTest.java | 6 +-
.../rpc/SaslClientDigestCallbackHandlerTest.java | 4 +-
.../core/rpc/SaslConnectionParamsTest.java | 12 +-
.../accumulo/core/rpc/TTimeoutTransportTest.java | 4 +-
.../AuthenticationTokenIdentifierTest.java | 8 +-
.../core/security/AuthenticationTokenTest.java | 6 +-
.../accumulo/core/security/AuthorizationsTest.java | 10 +-
.../core/security/ColumnVisibilityTest.java | 18 +--
.../accumulo/core/security/CredentialsTest.java | 34 +++---
.../core/security/NamespacePermissionsTest.java | 8 +-
.../core/security/VisibilityEvaluatorTest.java | 24 ++--
.../core/singletons/SingletonManagerTest.java | 18 +--
.../core/spi/balancer/GroupBalancerTest.java | 15 ++-
...tRegexTableLoadBalancerReconfigurationTest.java | 8 +-
.../balancer/HostRegexTableLoadBalancerTest.java | 16 +--
.../core/spi/balancer/SimpleLoadBalancerTest.java | 14 +--
.../core/spi/balancer/TableLoadBalancerTest.java | 4 +-
.../compaction/DefaultCompactionPlannerTest.java | 40 +++----
.../core/spi/fs/PerTableVolumeChooserTest.java | 14 +--
.../core/spi/fs/PreferredVolumeChooserTest.java | 14 +--
.../core/spi/fs/SpaceAwareVolumeChooserTest.java | 14 +--
.../core/spi/scan/HintScanPrioritizerTest.java | 4 +-
.../spi/scan/IdleRatioScanPrioritizerTest.java | 4 +-
.../core/spi/scan/SimpleScanDispatcherTest.java | 6 +-
.../core/summary/SummaryCollectionTest.java | 4 +-
.../core/tabletserver/log/LogEntryTest.java | 8 +-
.../apache/accumulo/core/util/AddressUtilTest.java | 15 ++-
.../accumulo/core/util/ByteBufferUtilTest.java | 4 +-
.../core/util/CompletableFutureUtilTest.java | 4 +-
.../apache/accumulo/core/util/FastFormatTest.java | 6 +-
.../apache/accumulo/core/util/InternerTest.java | 14 ++-
.../accumulo/core/util/LocalityGroupUtilTest.java | 12 +-
.../org/apache/accumulo/core/util/MergeTest.java | 6 +-
.../apache/accumulo/core/util/MonitorUtilTest.java | 14 +--
.../org/apache/accumulo/core/util/NumUtilTest.java | 4 +-
.../org/apache/accumulo/core/util/OpTimerTest.java | 10 +-
.../org/apache/accumulo/core/util/PairTest.java | 10 +-
.../apache/accumulo/core/util/PartitionerTest.java | 4 +-
.../accumulo/core/util/PreAllocatedArrayTest.java | 10 +-
.../org/apache/accumulo/core/util/StatTest.java | 8 +-
.../apache/accumulo/core/util/TextUtilTest.java | 6 +-
.../accumulo/core/util/ThriftMessageUtilTest.java | 8 +-
.../core/util/UnsynchronizedBufferTest.java | 13 +--
.../apache/accumulo/core/util/ValidatorTest.java | 10 +-
.../apache/accumulo/core/util/ValidatorsTest.java | 18 +--
.../util/compaction/CompactionPrioritizerTest.java | 4 +-
.../core/util/format/DateFormatSupplierTest.java | 10 +-
.../core/util/format/DateStringFormatterTest.java | 12 +-
.../core/util/format/DefaultFormatterTest.java | 10 +-
.../core/util/format/FormatterConfigTest.java | 18 +--
.../core/util/format/FormatterFactoryTest.java | 8 +-
.../core/util/format/HexFormatterTest.java | 12 +-
.../ShardedTableDistributionFormatterTest.java | 10 +-
.../format/StatisticsDisplayFormatterTest.java | 12 +-
.../accumulo/core/volume/VolumeImplTest.java | 10 +-
.../org/apache/accumulo/fate/AgeOffStoreTest.java | 4 +-
.../apache/accumulo/fate/ReadOnlyStoreTest.java | 6 +-
.../org/apache/accumulo/fate/util/RetryTest.java | 38 +++---
.../zookeeper/DistributedReadWriteLockTest.java | 4 +-
.../accumulo/fate/zookeeper/ServiceLockTest.java | 6 +-
.../fate/zookeeper/ZooCacheFactoryTest.java | 16 +--
.../accumulo/fate/zookeeper/ZooCacheTest.java | 18 +--
.../fate/zookeeper/ZooReaderWriterTest.java | 10 +-
.../accumulo/fate/zookeeper/ZooSessionTest.java | 8 +-
hadoop-mapreduce/pom.xml | 10 +-
iterator-test-harness/pom.xml | 9 +-
minicluster/pom.xml | 10 +-
pom.xml | 21 +++-
server/base/pom.xml | 10 +-
server/compaction-coordinator/pom.xml | 10 +-
server/compactor/pom.xml | 10 +-
server/gc/pom.xml | 10 +-
server/manager/pom.xml | 10 +-
server/monitor/pom.xml | 10 +-
server/native/pom.xml | 8 +-
server/tserver/pom.xml | 10 +-
shell/pom.xml | 10 +-
start/pom.xml | 10 +-
test/pom.xml | 8 +-
246 files changed, 1399 insertions(+), 1439 deletions(-)
diff --git a/core/pom.xml b/core/pom.xml
index e467081..ce4d377 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -155,11 +155,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-minicluster</artifactId>
<scope>test</scope>
@@ -174,6 +169,11 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<testResources>
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ByteSequenceTest.java b/core/src/test/java/org/apache/accumulo/core/WithTestNames.java
similarity index 55%
copy from core/src/test/java/org/apache/accumulo/core/data/ByteSequenceTest.java
copy to core/src/test/java/org/apache/accumulo/core/WithTestNames.java
index ac86bb3..d29323c 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ByteSequenceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/WithTestNames.java
@@ -16,28 +16,27 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.accumulo.core.data;
+package org.apache.accumulo.core;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestInfo;
-import org.junit.Test;
+// This is only for the unit tests and integration tests in this module
+// It must be copied for use in other modules, because tests in one module
+// don't have dependencies on other modules, and we can't put this in a
+// regular, non-test jar, because we don't want to add a dependency on
+// JUnit in a non-test jar
+public class WithTestNames {
-public class ByteSequenceTest {
+ private String testName;
- @Test
- public void testCompareBytes() {
- ByteSequence a = new ArrayByteSequence("a");
- ByteSequence b = new ArrayByteSequence("b");
- ByteSequence abc = new ArrayByteSequence("abc");
-
- assertLessThan(a, b);
- assertLessThan(a, abc);
- assertLessThan(abc, b);
+ @BeforeEach
+ public void setTestName(TestInfo info) {
+ testName = info.getTestMethod().get().getName();
}
- private void assertLessThan(ByteSequence lhs, ByteSequence rhs) {
- int result = ByteSequence.compareBytes(lhs, rhs);
- assertTrue(result < 0);
+ protected String testName() {
+ return testName;
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java b/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java
index 54f9924..b05856d 100644
--- a/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java
@@ -18,43 +18,46 @@
*/
package org.apache.accumulo.core.classloader;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.net.URLClassLoader;
+import java.util.Objects;
import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.conf.Property;
import org.apache.commons.io.FileUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not set by user input")
public class ContextClassLoaderFactoryTest {
- @Rule
- public TemporaryFolder tempFolder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static final File tempFolder = new File(System.getProperty("user.dir") + "/target",
+ ContextClassLoaderFactoryTest.class.getSimpleName() + "/");
- private File folder1;
- private File folder2;
private String uri1;
private String uri2;
- @Before
+ @BeforeEach
public void setup() throws Exception {
- folder1 = tempFolder.newFolder();
- FileUtils.copyURLToFile(this.getClass().getResource("/accumulo.properties"),
+ File folder1 = new File(tempFolder, "folder1/");
+ assertTrue(folder1.isDirectory() || folder1.mkdir(), "Failed to make a new sub-directory");
+ FileUtils.copyURLToFile(
+ Objects.requireNonNull(this.getClass().getResource("/accumulo.properties")),
new File(folder1, "accumulo.properties"));
uri1 = new File(folder1, "accumulo.properties").toURI().toString();
- folder2 = tempFolder.newFolder();
- FileUtils.copyURLToFile(this.getClass().getResource("/accumulo2.properties"),
+ File folder2 = new File(tempFolder, "folder2/");
+ assertTrue(folder2.isDirectory() || folder2.mkdir(), "Failed to make a new sub-directory");
+ FileUtils.copyURLToFile(
+ Objects.requireNonNull(this.getClass().getResource("/accumulo2.properties")),
new File(folder2, "accumulo2.properties"));
uri2 = folder2.toURI() + ".*";
diff --git a/core/src/test/java/org/apache/accumulo/core/cli/PasswordConverterTest.java b/core/src/test/java/org/apache/accumulo/core/cli/PasswordConverterTest.java
index 5e483a6..96853b4 100644
--- a/core/src/test/java/org/apache/accumulo/core/cli/PasswordConverterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/cli/PasswordConverterTest.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.core.cli;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.io.IOException;
@@ -31,10 +31,10 @@ import java.io.PipedOutputStream;
import java.security.SecureRandom;
import java.util.Scanner;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
@@ -53,12 +53,12 @@ public class PasswordConverterTest {
private Password password;
private static InputStream realIn;
- @BeforeClass
+ @BeforeAll
public static void saveIn() {
realIn = System.in;
}
- @Before
+ @BeforeEach
public void setup() throws IOException {
argv = new String[] {"--password", ""};
password = new Password();
@@ -72,7 +72,7 @@ public class PasswordConverterTest {
System.setIn(in);
}
- @After
+ @AfterEach
public void teardown() {
System.setIn(realIn);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java b/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java
index 61cc8b7..62fdf7a 100644
--- a/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java
+++ b/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.cli;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Properties;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.ClientProperty;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestClientOpts {
diff --git a/core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java b/core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java
index 3eb2c5f4..a714bda 100644
--- a/core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java
+++ b/core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.cli;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestHelp {
protected class HelpStub extends Help {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/BatchWriterConfigTest.java b/core/src/test/java/org/apache/accumulo/core/client/BatchWriterConfigTest.java
index 9d71dcf..40309ed 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/BatchWriterConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/BatchWriterConfigTest.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.core.client;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -32,7 +32,7 @@ import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.conf.ClientProperty;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BatchWriterConfigTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java
index b0712c4..fdf1cdc 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.client;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation")
public class ClientConfigurationTest {
@@ -72,15 +72,15 @@ public class ClientConfigurationTest {
@Test
public void testConfPath() throws IOException {
File target = new File(System.getProperty("user.dir"), "target");
- assertTrue("'target' build directory does not exist", target.exists());
+ assertTrue(target.exists(), "'target' build directory does not exist");
File testDir = new File(target, getClass().getName());
if (!testDir.exists()) {
- assertTrue("Failed to create test dir " + testDir, testDir.mkdirs());
+ assertTrue(testDir.mkdirs(), "Failed to create test dir " + testDir);
}
File clientConf = new File(testDir, "client.conf");
if (!clientConf.exists()) {
- assertTrue("Failed to create file " + clientConf, clientConf.createNewFile());
+ assertTrue(clientConf.createNewFile(), "Failed to create file " + clientConf);
}
// A directory should return the path with client.conf appended.
diff --git a/core/src/test/java/org/apache/accumulo/core/client/ClientPropertiesTest.java b/core/src/test/java/org/apache/accumulo/core/client/ClientPropertiesTest.java
index 2b364ed..6966df0 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/ClientPropertiesTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/ClientPropertiesTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.client;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.nio.file.Paths;
import java.util.Properties;
import org.apache.accumulo.core.conf.ClientProperty;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ClientPropertiesTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java b/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
index 08185b2..888572f 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
@@ -18,16 +18,16 @@
*/
package org.apache.accumulo.core.client;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.HashMap;
import java.util.Map;
import org.apache.accumulo.core.iterators.Combiner;
import org.apache.accumulo.core.iterators.DevNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test cases for the IteratorSetting class
diff --git a/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
index 5b9dbbd..182f601 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.client;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Iterator;
@@ -33,7 +33,7 @@ import java.util.TreeMap;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RowIteratorTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java b/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
index 4dd4615..2051c68 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.core.client;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
@@ -36,7 +36,7 @@ import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestThrift1474 {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java b/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
index bd50c64..bc9ed71 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/ZooKeeperInstanceTest.java
@@ -22,8 +22,8 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.List;
import java.util.UUID;
@@ -33,8 +33,8 @@ import org.apache.accumulo.core.data.InstanceId;
import org.apache.accumulo.fate.zookeeper.ZooCache;
import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class ZooKeeperInstanceTest {
@@ -67,7 +67,7 @@ public class ZooKeeperInstanceTest {
expect(config.get(INSTANCE_ZK_TIMEOUT)).andReturn("30");
}
- @Before
+ @BeforeEach
public void setUp() {
ClientConfiguration config = createMock(ClientConfiguration.class);
mockNameConstruction(config);
diff --git a/core/src/test/java/org/apache/accumulo/core/client/admin/DelegationTokenConfigTest.java b/core/src/test/java/org/apache/accumulo/core/client/admin/DelegationTokenConfigTest.java
index fd7dd3e..cef5343 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/admin/DelegationTokenConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/admin/DelegationTokenConfigTest.java
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.core.client.admin;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.concurrent.TimeUnit;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DelegationTokenConfigTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/admin/NewTableConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/client/admin/NewTableConfigurationTest.java
index 7196b2d..da982a5 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/admin/NewTableConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/admin/NewTableConfigurationTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.client.admin;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.EnumSet;
@@ -39,15 +39,15 @@ import org.apache.accumulo.core.client.summary.summarizers.FamilySummarizer;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class NewTableConfigurationTest {
private SortedSet<Text> splits;
private Map<String,String> options;
- @Before
+ @BeforeEach
public void setup() {
populateSplits();
populateOptions();
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
index ca82322..468f37a 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
@@ -22,7 +22,7 @@ import java.math.BigInteger;
import java.util.Arrays;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BigIntegerLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoderTest.java
index 34af459..22ab31e 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoderTest.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.core.client.lexicoder;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BytesLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DateLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DateLexicoderTest.java
index 79f82bd..4191c2f 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DateLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DateLexicoderTest.java
@@ -21,7 +21,7 @@ package org.apache.accumulo.core.client.lexicoder;
import java.util.Date;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DateLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
index af770a0..c26540c 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
@@ -21,7 +21,7 @@ package org.apache.accumulo.core.client.lexicoder;
import java.util.Arrays;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DoubleLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/FloatLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/FloatLexicoderTest.java
index 88c391e..6257991 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/FloatLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/FloatLexicoderTest.java
@@ -21,7 +21,7 @@ package org.apache.accumulo.core.client.lexicoder;
import java.util.Arrays;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FloatLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java
index 8948ba5..1a74b48 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java
@@ -21,7 +21,7 @@ package org.apache.accumulo.core.client.lexicoder;
import java.util.Arrays;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class IntegerLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java
index 6a3246d..c2c8d1a 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.client.lexicoder;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
index f0e13d1..4a0ece8 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.core.client.lexicoder;
import static java.util.Collections.emptyList;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.List;
@@ -29,8 +29,8 @@ import java.util.TreeSet;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ListLexicoderTest extends AbstractLexicoderTest {
@@ -40,7 +40,7 @@ public class ListLexicoderTest extends AbstractLexicoderTest {
private List<Long> data4 = new ArrayList<>();
private List<Long> data5 = new ArrayList<>();
- @Before
+ @BeforeEach
public void setUp() {
data1.add(1L);
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java
index ad2204b..6a7f1e0 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java
@@ -21,7 +21,7 @@ package org.apache.accumulo.core.client.lexicoder;
import java.util.Arrays;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class LongLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
index 2647533..e877d6d 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
@@ -22,7 +22,7 @@ import java.util.Arrays;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
import org.apache.accumulo.core.util.ComparablePair;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class PairLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java
index edfddaa..2801300 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java
@@ -25,7 +25,7 @@ import java.util.Comparator;
import java.util.Date;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ReverseLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/SequenceLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/SequenceLexicoderTest.java
index 3a61dac..151dfff 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/SequenceLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/SequenceLexicoderTest.java
@@ -21,8 +21,8 @@ package org.apache.accumulo.core.client.lexicoder;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.List;
@@ -31,7 +31,7 @@ import java.util.TreeSet;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link SequenceLexicoder}.
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/StringLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/StringLexicoderTest.java
index 3368449..5bf5e27 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/StringLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/StringLexicoderTest.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.core.client.lexicoder;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class StringLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/TextLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/TextLexicoderTest.java
index 6062724..99605d1 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/TextLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/TextLexicoderTest.java
@@ -20,7 +20,7 @@ package org.apache.accumulo.core.client.lexicoder;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TextLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
index cb7e150..73645e5 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.core.client.lexicoder;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class UIntegerLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java
index 6bcb1e0..0d6c6f2 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java
@@ -21,7 +21,7 @@ package org.apache.accumulo.core.client.lexicoder;
import java.util.Arrays;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ULongLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java
index 602c7c7..f04064c 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java
@@ -23,7 +23,7 @@ import java.util.Arrays;
import java.util.UUID;
import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class UUIDLexicoderTest extends AbstractLexicoderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
index d7134e7..fb81831 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.client.mapred;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.accumulo.core.client.sample.RowSampler;
import org.apache.accumulo.core.client.sample.SamplerConfiguration;
@@ -26,7 +26,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class AccumuloFileOutputFormatTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
index fb6e686..b822f9a 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.client.mapred;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@@ -30,20 +30,15 @@ import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.iterators.user.RegExFilter;
import org.apache.accumulo.core.iterators.user.WholeRowIterator;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class AccumuloInputFormatTest {
private JobConf job;
- @Rule
- public TestName test = new TestName();
-
- @Before
+ @BeforeEach
public void createJob() {
job = new JobConf();
}
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java
index 934b51c..25b02c5 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java
@@ -18,26 +18,22 @@
*/
package org.apache.accumulo.core.client.mapred;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import org.apache.accumulo.core.WithTestNames;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
-public class AccumuloMultiTableInputFormatTest {
-
- @Rule
- public TestName testName = new TestName();
+public class AccumuloMultiTableInputFormatTest extends WithTestNames {
/**
* Verify {@link org.apache.accumulo.core.client.mapreduce.InputTableConfig} objects get correctly
@@ -45,8 +41,8 @@ public class AccumuloMultiTableInputFormatTest {
*/
@Test
public void testTableQueryConfigSerialization() {
- String table1Name = testName.getMethodName() + "1";
- String table2Name = testName.getMethodName() + "2";
+ String table1Name = testName() + "1";
+ String table2Name = testName() + "2";
JobConf job = new JobConf();
org.apache.accumulo.core.client.mapreduce.InputTableConfig table1 =
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
index d510a2e..eaad58c 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.client.mapred;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
@@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class AccumuloOutputFormatTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
index 2992967..0927c43 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.client.mapred;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -40,7 +40,7 @@ import org.apache.accumulo.core.iterators.user.WholeRowIterator;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Level;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class RangeInputSplitTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
index 6987fd4..73524aa 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.client.mapreduce;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
@@ -28,7 +28,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl;
import org.apache.hadoop.mapreduce.Job;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class AccumuloFileOutputFormatTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index bb8c33b..58cce42 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.client.mapreduce;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class AccumuloInputFormatTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java
index 7b86f4c..25f15f8 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java
@@ -18,35 +18,31 @@
*/
package org.apache.accumulo.core.client.mapreduce;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import org.apache.accumulo.core.WithTestNames;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
-public class AccumuloMultiTableInputFormatTest {
-
- @Rule
- public TestName testName = new TestName();
+public class AccumuloMultiTableInputFormatTest extends WithTestNames {
/**
* Verify {@link InputTableConfig} objects get correctly serialized in the JobContext.
*/
@Test
public void testInputTableConfigSerialization() throws IOException {
- String table1 = testName.getMethodName() + "1";
- String table2 = testName.getMethodName() + "2";
+ String table1 = testName() + "1";
+ String table2 = testName() + "2";
Job job = Job.getInstance();
InputTableConfig tableConfig = new InputTableConfig()
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
index d398474..fa06829 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.client.mapreduce;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
@@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobContext;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class AccumuloOutputFormatTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
index a5f3cc9..1071da6 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.client.mapreduce;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -35,15 +35,15 @@ import org.apache.accumulo.core.client.sample.SamplerConfiguration;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class InputTableConfigTest {
private InputTableConfig tableQueryConfig;
- @Before
+ @BeforeEach
public void setUp() {
tableQueryConfig = new InputTableConfig();
}
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
index 8500699..f49195f 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.client.mapreduce;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -40,7 +40,7 @@ import org.apache.accumulo.core.iterators.user.WholeRowIterator;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Level;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class RangeInputSplitTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
index 4b57e51..11210e1 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.client.mapreduce.lib.partition;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class RangePartitionerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileClientTest.java b/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileClientTest.java
index 52e15f8..54dc285 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileClientTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/rfile/RFileClientTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.client.rfile;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
@@ -67,7 +67,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
index b7dbebf..9845041 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.client.security;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashSet;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SecurityErrorCodeTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java
index 39983ec..c7edbed 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java
@@ -19,17 +19,17 @@
package org.apache.accumulo.core.client.security.tokens;
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.assertNotNull;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.net.URL;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Properties;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -40,7 +40,7 @@ public class CredentialProviderTokenTest {
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN",
justification = "keystoreUrl location isn't provided by user input")
- @BeforeClass
+ @BeforeAll
public static void setup() {
URL keystoreUrl = CredentialProviderTokenTest.class.getResource("/passwords.jceks");
assertNotNull(keystoreUrl);
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenImplTest.java
index c38edbf..f1afc0e 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenImplTest.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.core.client.security.tokens;
import static org.apache.accumulo.core.clientImpl.AuthenticationTokenIdentifier.createTAuthIdentifier;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -30,7 +30,7 @@ import java.io.IOException;
import org.apache.accumulo.core.clientImpl.AuthenticationTokenIdentifier;
import org.apache.accumulo.core.clientImpl.DelegationTokenImpl;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DelegationTokenImplTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/KerberosTokenTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/KerberosTokenTest.java
index e522183..802c175 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/KerberosTokenTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/KerberosTokenTest.java
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.core.client.security.tokens;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Set;
import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test class for {@link KerberosToken}.
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java
index 4422914..cad3342 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.core.client.security.tokens;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -32,7 +32,7 @@ import java.util.List;
import javax.security.auth.DestroyFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class PasswordTokenTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/summary/CountingSummarizerTest.java b/core/src/test/java/org/apache/accumulo/core/client/summary/CountingSummarizerTest.java
index 9fc5e6b..d4e17f9 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/summary/CountingSummarizerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/summary/CountingSummarizerTest.java
@@ -27,7 +27,7 @@ import static org.apache.accumulo.core.client.summary.CountingSummarizer.MAX_COU
import static org.apache.accumulo.core.client.summary.CountingSummarizer.SEEN_STAT;
import static org.apache.accumulo.core.client.summary.CountingSummarizer.TOO_LONG_STAT;
import static org.apache.accumulo.core.client.summary.CountingSummarizer.TOO_MANY_STAT;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.HashMap;
@@ -37,7 +37,7 @@ import org.apache.accumulo.core.client.summary.summarizers.FamilySummarizer;
import org.apache.accumulo.core.client.summary.summarizers.VisibilitySummarizer;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CountingSummarizerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/summary/summarizers/AuthorizationSummarizerTest.java b/core/src/test/java/org/apache/accumulo/core/client/summary/summarizers/AuthorizationSummarizerTest.java
index e4d7a58..778d7d3 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/summary/summarizers/AuthorizationSummarizerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/summary/summarizers/AuthorizationSummarizerTest.java
@@ -24,7 +24,7 @@ import static org.apache.accumulo.core.client.summary.CountingSummarizer.EMITTED
import static org.apache.accumulo.core.client.summary.CountingSummarizer.SEEN_STAT;
import static org.apache.accumulo.core.client.summary.CountingSummarizer.TOO_LONG_STAT;
import static org.apache.accumulo.core.client.summary.CountingSummarizer.TOO_MANY_STAT;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
@@ -32,7 +32,7 @@ import org.apache.accumulo.core.client.summary.Summarizer.Collector;
import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AuthorizationSummarizerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/summary/summarizers/EntryLengthSummarizersTest.java b/core/src/test/java/org/apache/accumulo/core/client/summary/summarizers/EntryLengthSummarizersTest.java
index 08c2eb1..3ba75ab 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/summary/summarizers/EntryLengthSummarizersTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/summary/summarizers/EntryLengthSummarizersTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.client.summary.summarizers;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
@@ -27,7 +27,7 @@ import org.apache.accumulo.core.client.summary.Summarizer.Combiner;
import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class EntryLengthSummarizersTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientConfConverterTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientConfConverterTest.java
index a42f7d3..28727e4 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientConfConverterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientConfConverterTest.java
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Properties;
import org.apache.accumulo.core.conf.ClientProperty;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ClientConfConverterTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java
index aa95e5e..7ba0135 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.File;
import java.net.URL;
@@ -36,8 +36,8 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
import org.apache.accumulo.core.conf.Property;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -51,10 +51,10 @@ public class ClientContextTest {
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN",
justification = "provided keystoreUrl path isn't user provided")
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
URL keystoreUrl = ClientContextTest.class.getResource(keystoreName);
- assertNotNull("Could not find " + keystoreName, keystoreUrl);
+ assertNotNull(keystoreUrl, "Could not find " + keystoreName);
keystore = new File(keystoreUrl.getFile());
}
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ConditionalComparatorTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ConditionalComparatorTest.java
index 4add5b3..82c6543 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ConditionalComparatorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ConditionalComparatorTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Comparator;
import org.apache.accumulo.core.data.Condition;
import org.apache.accumulo.core.security.ColumnVisibility;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ConditionalComparatorTest {
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/DelegationTokenConfigSerializerTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/DelegationTokenConfigSerializerTest.java
index 9053886..5f38cbd 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/DelegationTokenConfigSerializerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/DelegationTokenConfigSerializerTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.admin.DelegationTokenConfig;
import org.apache.accumulo.core.securityImpl.thrift.TDelegationTokenConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DelegationTokenConfigSerializerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/RootTabletLocatorTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/RootTabletLocatorTest.java
index a47158f..0ba5b07 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/RootTabletLocatorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/RootTabletLocatorTest.java
@@ -26,8 +26,8 @@ import static org.easymock.EasyMock.verify;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.clientImpl.TabletLocatorImpl.TabletServerLockChecker;
import org.apache.accumulo.fate.zookeeper.ZooCache;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class RootTabletLocatorTest {
private ClientContext context;
@@ -35,7 +35,7 @@ public class RootTabletLocatorTest {
private ZooCache zc;
private RootTabletLocator rtl;
- @Before
+ @BeforeEach
public void setUp() {
context = createMock(ClientContext.class);
expect(context.getZooKeeperRoot()).andReturn("/accumulo/iid").anyTimes();
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerBaseTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerBaseTest.java
index 9761937..56ac363 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerBaseTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerBaseTest.java
@@ -22,7 +22,7 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.partialMockBuilder;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
import java.util.Map;
@@ -30,7 +30,7 @@ import java.util.Map;
import org.apache.accumulo.core.client.ScannerBase;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ScannerBaseTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerImplTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerImplTest.java
index 1e21474..cbf0dd2 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerImplTest.java
@@ -18,20 +18,20 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.security.Authorizations;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ScannerImplTest {
private ClientContext context;
- @Before
+ @BeforeEach
public void setup() {
context = EasyMock.createMock(ClientContext.class);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerOptionsTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerOptionsTest.java
index c1ae9db..a8a7c31 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerOptionsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ScannerOptionsTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.SortedSet;
@@ -28,7 +28,7 @@ import org.apache.accumulo.core.data.Column;
import org.apache.accumulo.core.iterators.DebugIterator;
import org.apache.accumulo.core.iterators.user.WholeRowIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test that scanner options are set/unset correctly
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/TableOperationsHelperTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/TableOperationsHelperTest.java
index c77bbe3..f95ebb7 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/TableOperationsHelperTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/TableOperationsHelperTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.Collections;
@@ -48,7 +48,7 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TableOperationsHelperTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/TabletLocatorImplTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/TabletLocatorImplTest.java
index 0ab5c3d..bce2cfa 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/TabletLocatorImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/TabletLocatorImplTest.java
@@ -19,11 +19,11 @@
package org.apache.accumulo.core.clientImpl;
import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
@@ -57,8 +57,8 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.Cu
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.TabletColumnFamily;
import org.apache.hadoop.io.Text;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class TabletLocatorImplTest {
@@ -173,7 +173,7 @@ public class TabletLocatorImplTest {
private ClientContext context;
private InstanceId iid;
- @Before
+ @BeforeEach
public void setUp() {
context = EasyMock.createMock(ClientContext.class);
iid = InstanceId.of("instance1");
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderTest.java
index 7654df8..fc918b5 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderTest.java
@@ -18,21 +18,21 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.accumulo.core.client.BatchScanner;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.security.Authorizations;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class TabletServerBatchReaderTest {
private ClientContext context;
- @Before
+ @BeforeEach
public void setup() {
context = EasyMock.createMock(ClientContext.class);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ThriftScannerTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ThriftScannerTest.java
index 277ceae..6c2baa9 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ThriftScannerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ThriftScannerTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.clientImpl;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test calls for {@link ThriftScanner}.
@@ -35,15 +35,15 @@ public class ThriftScannerTest {
@Test
public void testPauseIncrease() throws Exception {
long newPause = ThriftScanner.pause(5L, 5000L);
- assertTrue("New pause should be within [9,11], but was " + newPause,
- withinTenPercent(10L, newPause));
+ assertTrue(withinTenPercent(10L, newPause),
+ "New pause should be within [9,11], but was " + newPause);
}
@Test
public void testMaxPause() throws Exception {
long maxPause = 1L;
long nextPause = ThriftScanner.pause(5L, maxPause);
- assertTrue("New pause should be within [0,2], but was " + nextPause,
- withinTenPercent(maxPause, nextPause));
+ assertTrue(withinTenPercent(maxPause, nextPause),
+ "New pause should be within [0,2], but was " + nextPause);
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ThriftTransportKeyTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ThriftTransportKeyTest.java
index 95abe2d..3630d57 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ThriftTransportKeyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ThriftTransportKeyTest.java
@@ -22,9 +22,9 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
@@ -40,14 +40,14 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.security.UserGroupInformation;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ThriftTransportKeyTest {
private static final String primary = "accumulo";
- @Before
+ @BeforeEach
public void setup() {
System.setProperty("java.security.krb5.realm", "accumulo");
System.setProperty("java.security.krb5.kdc", "fake");
@@ -139,6 +139,6 @@ public class ThriftTransportKeyTest {
ThriftTransportKey ttk =
new ThriftTransportKey(HostAndPort.fromParts("localhost", 9999), 120_000, clientCtx);
- assertEquals("Normal ThriftTransportKey doesn't equal itself", ttk, ttk);
+ assertEquals(ttk, ttk, "Normal ThriftTransportKey doesn't equal itself");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ZookeeperLockCheckerTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ZookeeperLockCheckerTest.java
index 6ac8a18..32fb76b 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ZookeeperLockCheckerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ZookeeperLockCheckerTest.java
@@ -25,15 +25,15 @@ import static org.easymock.EasyMock.verify;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.fate.zookeeper.ZooCache;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ZookeeperLockCheckerTest {
private ClientContext context;
private ZooCache zc;
private ZookeeperLockChecker zklc;
- @Before
+ @BeforeEach
public void setUp() {
context = createMock(ClientContext.class);
expect(context.getZooKeeperRoot()).andReturn("/accumulo/iid").anyTimes();
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkImportFilterInvalidTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkImportFilterInvalidTest.java
index fd451dc..2752d08 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkImportFilterInvalidTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkImportFilterInvalidTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.clientImpl.bulk;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.Arrays;
@@ -29,21 +29,21 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class BulkImportFilterInvalidTest {
FileSystem fs;
Path testdir = new Path("testing");
- @Before
+ @BeforeEach
public void setup() throws IOException {
fs = FileSystem.getLocal(new Configuration());
fs.mkdirs(testdir);
}
- @After
+ @AfterEach
public void cleanup() throws IOException {
fs.delete(testdir, true);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkImportTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkImportTest.java
index b551148..458144b 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkImportTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkImportTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.clientImpl.bulk;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.clientImpl.bulk.Bulk.Files;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BulkImportTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkSerializeTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkSerializeTest.java
index 258d58b..539b469 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkSerializeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/BulkSerializeTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.clientImpl.bulk;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.clientImpl.bulk.BulkSerialize.Input;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BulkSerializeTest {
@@ -71,8 +71,8 @@ public class BulkSerializeTest {
Map<String,String> readMap = BulkSerialize.readRenameMap("/some/dir", p -> bais);
- assertEquals("Read renames file wrong size", renames.size(), readMap.size());
- assertEquals("Read renames file different from what was written.", renames, readMap);
+ assertEquals(renames.size(), readMap.size(), "Read renames file wrong size");
+ assertEquals(renames, readMap, "Read renames file different from what was written.");
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/ConcurrentKeyExtentCacheTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/ConcurrentKeyExtentCacheTest.java
index 96ca947..f92342c 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/ConcurrentKeyExtentCacheTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/bulk/ConcurrentKeyExtentCacheTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.clientImpl.bulk;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.security.SecureRandom;
import java.util.ArrayList;
@@ -33,8 +33,8 @@ import java.util.stream.Stream;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.hadoop.io.Text;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import com.google.common.util.concurrent.Uninterruptibles;
@@ -45,7 +45,7 @@ public class ConcurrentKeyExtentCacheTest {
private static List<KeyExtent> extents = new ArrayList<>();
private static Set<KeyExtent> extentsSet = new HashSet<>();
- @BeforeClass
+ @BeforeAll
public static void setupSplits() {
Text prev = null;
for (int i = 1; i < 255; i++) {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/lexicoder/AbstractLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/lexicoder/AbstractLexicoderTest.java
index 48b474a..cd59895 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/lexicoder/AbstractLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/lexicoder/AbstractLexicoderTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.clientImpl.lexicoder;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.accumulo.core.client.lexicoder.AbstractLexicoder;
import org.apache.accumulo.core.client.lexicoder.LexicoderTest;
@@ -68,20 +68,21 @@ public abstract class AbstractLexicoderTest extends LexicoderTest {
protected static <T> void assertOutOfBoundsFails(AbstractLexicoder<T> lexicoder, byte[] encoded) {
// decode null; should fail
- assertThrows("Should throw on null bytes.", NullPointerException.class,
- () -> lexicoder.decode(null, 0, encoded.length));
+ assertThrows(NullPointerException.class, () -> lexicoder.decode(null, 0, encoded.length),
+ "Should throw on null bytes.");
// decode out of bounds, expect an exception
- assertThrows("Should throw on exceeding length.", IllegalArgumentException.class,
- () -> lexicoder.decode(encoded, 0, encoded.length + 1));
+ assertThrows(IllegalArgumentException.class,
+ () -> lexicoder.decode(encoded, 0, encoded.length + 1),
+ "Should throw on exceeding length.");
- assertThrows("Should throw on negative offset.", IllegalArgumentException.class,
- () -> lexicoder.decode(encoded, -1, encoded.length));
+ assertThrows(IllegalArgumentException.class,
+ () -> lexicoder.decode(encoded, -1, encoded.length), "Should throw on negative offset.");
- assertThrows("Should throw on negative length.", IllegalArgumentException.class,
- () -> lexicoder.decode(encoded, 0, -1));
+ assertThrows(IllegalArgumentException.class, () -> lexicoder.decode(encoded, 0, -1),
+ "Should throw on negative length.");
- assertThrows("Should throw on negative length, even if (offset+len) is within bounds.",
- IllegalArgumentException.class, () -> lexicoder.decode(encoded, 1, -1));
+ assertThrows(IllegalArgumentException.class, () -> lexicoder.decode(encoded, 1, -1),
+ "Should throw on negative length, even if (offset+len) is within bounds.");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/lexicoder/ByteUtilsTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/lexicoder/ByteUtilsTest.java
index 629434e..8bf502b 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/lexicoder/ByteUtilsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/lexicoder/ByteUtilsTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.clientImpl.lexicoder;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ByteUtilsTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/mapreduce/BatchInputSplitTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/mapreduce/BatchInputSplitTest.java
index 11f9dc8..d78133b 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/mapreduce/BatchInputSplitTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/mapreduce/BatchInputSplitTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.clientImpl.mapreduce;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -43,7 +43,7 @@ import org.apache.accumulo.core.iterators.user.WholeRowIterator;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Level;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated(since = "2.0.0")
public class BatchInputSplitTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/mapreduce/lib/ConfiguratorBaseTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/mapreduce/lib/ConfiguratorBaseTest.java
index cf331ad..ceb0cda 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/mapreduce/lib/ConfiguratorBaseTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/mapreduce/lib/ConfiguratorBaseTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.clientImpl.mapreduce.lib;
-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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Base64;
@@ -32,7 +32,7 @@ import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.hadoop.conf.Configuration;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ConfiguratorBaseTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
index 4044ae6..d03e1a8 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.core.conf;
-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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.HashMap;
@@ -33,7 +33,7 @@ import java.util.function.Predicate;
import org.apache.accumulo.core.conf.AccumuloConfiguration.ScanExecutorConfig;
import org.apache.accumulo.core.spi.scan.SimpleScanDispatcher;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AccumuloConfigurationTest {
@@ -54,7 +54,7 @@ public class AccumuloConfigurationTest {
assertEquals(p.getDefaultValue(), c.get(p.getKey()));
}
}
- assertTrue("test was a dud, and did nothing", found);
+ assertTrue(found, "test was a dud, and did nothing");
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/ClientPropertyTest.java b/core/src/test/java/org/apache/accumulo/core/conf/ClientPropertyTest.java
index f15b20c..db76b93 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/ClientPropertyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/ClientPropertyTest.java
@@ -18,15 +18,15 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Properties;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ClientPropertyTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/ConfigCheckUtilTest.java b/core/src/test/java/org/apache/accumulo/core/conf/ConfigCheckUtilTest.java
index d407736..aeb7a73 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/ConfigCheckUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/ConfigCheckUtilTest.java
@@ -18,18 +18,18 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Map;
import org.apache.accumulo.core.conf.ConfigCheckUtil.ConfigCheckException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ConfigCheckUtilTest {
private Map<String,String> m;
- @Before
+ @BeforeEach
public void setUp() {
m = new java.util.HashMap<>();
}
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/ConfigurationTypeHelperTest.java b/core/src/test/java/org/apache/accumulo/core/conf/ConfigurationTypeHelperTest.java
index cbbaf29..01fdc73 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/ConfigurationTypeHelperTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/ConfigurationTypeHelperTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import java.util.function.Function;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ConfigurationTypeHelperTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
index f8dd452..80c245c 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
@@ -18,19 +18,19 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class DefaultConfigurationTest {
private DefaultConfiguration c;
- @Before
+ @BeforeEach
public void setUp() {
c = DefaultConfiguration.getInstance();
}
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/DeprecatedPropertyUtilTest.java b/core/src/test/java/org/apache/accumulo/core/conf/DeprecatedPropertyUtilTest.java
index 4f5c8aa..16ed1a2 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/DeprecatedPropertyUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/DeprecatedPropertyUtilTest.java
@@ -18,16 +18,16 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import java.util.function.BiConsumer;
import org.apache.commons.configuration2.BaseConfiguration;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
public class DeprecatedPropertyUtilTest {
@@ -45,7 +45,7 @@ public class DeprecatedPropertyUtilTest {
private static final BiConsumer<Logger,String> NOOP = (log, replacement) -> {};
- @BeforeClass
+ @BeforeAll
public static void setup() {
TestPropertyUtil.registerTestRenamer();
}
@@ -89,9 +89,9 @@ public class DeprecatedPropertyUtilTest {
DeprecatedPropertyUtil.sanityCheckManagerProperties(config); // should succeed
config.setProperty("manager.replacementProp", "value");
assertEquals(4, config.size());
- assertThrows("Sanity check should fail when 'master.*' and 'manager.*' appear in same config",
- IllegalStateException.class,
- () -> DeprecatedPropertyUtil.sanityCheckManagerProperties(config));
+ assertThrows(IllegalStateException.class,
+ () -> DeprecatedPropertyUtil.sanityCheckManagerProperties(config),
+ "Sanity check should fail when 'master.*' and 'manager.*' appear in same config");
config.clearProperty("master.deprecatedProp");
assertEquals(3, config.size());
DeprecatedPropertyUtil.sanityCheckManagerProperties(config); // should succeed
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java b/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java
index 5048fa3..a453406 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.net.URL;
@@ -36,8 +36,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,14 +53,14 @@ public class HadoopCredentialProviderTest {
emptyKeyStoreName = "/empty.jceks";
private static File emptyKeyStore, populatedKeyStore;
- @BeforeClass
+ @BeforeAll
public static void checkCredentialProviderAvailable() {
URL populatedKeyStoreUrl =
HadoopCredentialProviderTest.class.getResource(populatedKeyStoreName),
emptyKeyStoreUrl = HadoopCredentialProviderTest.class.getResource(emptyKeyStoreName);
- assertNotNull("Could not find " + populatedKeyStoreName, populatedKeyStoreUrl);
- assertNotNull("Could not find " + emptyKeyStoreName, emptyKeyStoreUrl);
+ assertNotNull(populatedKeyStoreUrl, "Could not find " + populatedKeyStoreName);
+ assertNotNull(emptyKeyStoreUrl, "Could not find " + emptyKeyStoreName);
populatedKeyStore = new File(populatedKeyStoreUrl.getFile());
emptyKeyStore = new File(emptyKeyStoreUrl.getFile());
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/IterConfigUtilTest.java b/core/src/test/java/org/apache/accumulo/core/conf/IterConfigUtilTest.java
index bb3b916..5faa3fd 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/IterConfigUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/IterConfigUtilTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -44,7 +44,7 @@ import org.apache.accumulo.core.iterators.system.MultiIteratorTest;
import org.apache.accumulo.core.iterators.user.AgeOffFilter;
import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
index 609ce5b..d568bf9 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashSet;
import java.util.Map.Entry;
@@ -32,7 +32,7 @@ import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the Property class
@@ -51,18 +51,17 @@ public class PropertyTest {
for (Property prop : Property.values()) {
// make sure properties default values match their type
if (prop.getType() == PropertyType.PREFIX) {
- assertNull("PREFIX property " + prop.name() + " has unexpected non-null default value.",
- prop.getDefaultValue());
+ assertNull(prop.getDefaultValue(),
+ "PREFIX property " + prop.name() + " has unexpected non-null default value.");
} else {
- assertTrue(
+ assertTrue(prop.getType().isValidFormat(prop.getDefaultValue()),
"Property " + prop + " has invalid default value " + prop.getDefaultValue()
- + " for type " + prop.getType(),
- prop.getType().isValidFormat(prop.getDefaultValue()));
+ + " for type " + prop.getType());
}
// make sure property has a description
- assertFalse("Description not set for " + prop,
- prop.getDescription() == null || prop.getDescription().isEmpty());
+ assertFalse(prop.getDescription() == null || prop.getDescription().isEmpty(),
+ "Description not set for " + prop);
// make sure property starts with valid prefix
boolean containsValidPrefix = false;
@@ -72,11 +71,11 @@ public class PropertyTest {
break;
}
}
- assertTrue("Invalid prefix on prop " + prop, containsValidPrefix);
+ assertTrue(containsValidPrefix, "Invalid prefix on prop " + prop);
// make sure properties aren't duplicate
- assertFalse("Duplicate property name " + prop.getKey(),
- propertyNames.contains(prop.getKey()));
+ assertFalse(propertyNames.contains(prop.getKey()),
+ "Duplicate property name " + prop.getKey());
propertyNames.add(prop.getKey());
}
@@ -88,9 +87,9 @@ public class PropertyTest {
for (Property prop : Property.values()) {
if (prop.getType().equals(PropertyType.PORT)) {
int port = Integer.parseInt(prop.getDefaultValue());
- assertFalse("Port already in use: " + port, usedPorts.contains(port));
+ assertFalse(usedPorts.contains(port), "Port already in use: " + port);
usedPorts.add(port);
- assertTrue("Port out of range of valid ports: " + port, port > 1023 && port < 65536);
+ assertTrue(port > 1023 && port < 65536, "Port out of range of valid ports: " + port);
}
}
}
@@ -172,7 +171,7 @@ public class PropertyTest {
public void testIsValidTablePropertyKey() {
for (Property prop : Property.values()) {
if (prop.getKey().startsWith("table.") && !prop.getKey().equals("table.")) {
- assertTrue(prop.getKey(), Property.isValidTablePropertyKey(prop.getKey()));
+ assertTrue(Property.isValidTablePropertyKey(prop.getKey()), prop.getKey());
if (prop.getType().equals(PropertyType.PREFIX)) {
assertTrue(Property.isValidTablePropertyKey(prop.getKey() + "foo9"));
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
index 269efbd..cfbde32 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.Method;
import java.util.Arrays;
@@ -28,28 +28,25 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.apache.accumulo.core.WithTestNames;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.base.Joiner;
-public class PropertyTypeTest {
+public class PropertyTypeTest extends WithTestNames {
- @Rule
- public TestName testName = new TestName();
- private PropertyType type = null;
+ private PropertyType type;
- @Before
+ @BeforeEach
public void getPropertyTypeForTest() {
- String tn = testName.getMethodName();
- if (tn.startsWith("testType")) {
+ if (testName().startsWith("testType")) {
+ String tn = testName().substring("testType".length());
try {
- type = PropertyType.valueOf(tn.substring(8));
+ type = PropertyType.valueOf(tn);
} catch (IllegalArgumentException e) {
throw new AssertionError("Unexpected test method for non-existent "
- + PropertyType.class.getSimpleName() + "." + tn.substring(8));
+ + PropertyType.class.getSimpleName() + "." + tn);
}
}
}
@@ -78,8 +75,8 @@ public class PropertyTypeTest {
.collect(Collectors.toList());
types = types.map(t -> {
- assertTrue(PropertyType.class.getSimpleName() + "." + t + " does not have a test.",
- typesTested.contains(t));
+ assertTrue(typesTested.contains(t),
+ PropertyType.class.getSimpleName() + "." + t + " does not have a test.");
return t;
});
assertEquals(types.count(), typesTested.size());
@@ -87,17 +84,15 @@ public class PropertyTypeTest {
private void valid(final String... args) {
for (String s : args) {
- assertTrue(
- s + " should be valid for " + PropertyType.class.getSimpleName() + "." + type.name(),
- type.isValidFormat(s));
+ assertTrue(type.isValidFormat(s),
+ s + " should be valid for " + PropertyType.class.getSimpleName() + "." + type.name());
}
}
private void invalid(final String... args) {
for (String s : args) {
- assertFalse(
- s + " should be invalid for " + PropertyType.class.getSimpleName() + "." + type.name(),
- type.isValidFormat(s));
+ assertFalse(type.isValidFormat(s),
+ s + " should be invalid for " + PropertyType.class.getSimpleName() + "." + type.name());
}
}
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 46de207..3d30520 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
@@ -18,16 +18,16 @@
*/
package org.apache.accumulo.core.conf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.File;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParserTest.java b/core/src/test/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParserTest.java
index 91e9c44..a248a2a 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParserTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParserTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.conf.cluster;
-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 static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.BufferedReader;
import java.io.File;
@@ -33,7 +33,7 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
index 93c9e3a..84971a0 100644
--- a/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.constraints;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collections;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation")
public class DefaultKeySizeConstraintTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
index b2af811..1662d45 100644
--- a/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.constraints;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collections;
import java.util.List;
@@ -27,7 +27,7 @@ import org.apache.accumulo.core.data.ColumnUpdate;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/NoDeleteConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/NoDeleteConstraintTest.java
index d1fafab..60af596 100644
--- a/core/src/test/java/org/apache/accumulo/core/constraints/NoDeleteConstraintTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/constraints/NoDeleteConstraintTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.constraints;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.List;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation")
public class NoDeleteConstraintTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/VisibilityConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/VisibilityConstraintTest.java
index d9b5964..233cb38 100644
--- a/core/src/test/java/org/apache/accumulo/core/constraints/VisibilityConstraintTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/constraints/VisibilityConstraintTest.java
@@ -23,8 +23,8 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.Arrays;
import java.util.List;
@@ -33,8 +33,8 @@ import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.security.AuthorizationContainer;
import org.apache.accumulo.core.security.ColumnVisibility;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation")
public class VisibilityConstraintTest {
@@ -50,7 +50,7 @@ public class VisibilityConstraintTest {
static final List<Short> ENOAUTH = Arrays.asList((short) 2);
- @Before
+ @BeforeEach
public void setUp() {
vc = new VisibilityConstraint();
mutation = new Mutation("r");
@@ -69,33 +69,33 @@ public class VisibilityConstraintTest {
@Test
public void testNoVisibility() {
mutation.put(D, D, D);
- assertNull("authorized", vc.check(env, mutation));
+ assertNull(vc.check(env, mutation), "authorized");
}
@Test
public void testVisibilityNoAuth() {
mutation.put(D, D, bad, D);
- assertEquals("unauthorized", ENOAUTH, vc.check(env, mutation));
+ assertEquals(ENOAUTH, vc.check(env, mutation), "unauthorized");
}
@Test
public void testGoodVisibilityAuth() {
mutation.put(D, D, good, D);
- assertNull("authorized", vc.check(env, mutation));
+ assertNull(vc.check(env, mutation), "authorized");
}
@Test
public void testCachedVisibilities() {
mutation.put(D, D, good, "v");
mutation.put(D, D, good, "v2");
- assertNull("authorized", vc.check(env, mutation));
+ assertNull(vc.check(env, mutation), "authorized");
}
@Test
public void testMixedVisibilities() {
mutation.put(D, D, bad, D);
mutation.put(D, D, good, D);
- assertEquals("unauthorized", ENOAUTH, vc.check(env, mutation));
+ assertEquals(ENOAUTH, vc.check(env, mutation), "unauthorized");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/crypto/BlockedIOStreamTest.java b/core/src/test/java/org/apache/accumulo/core/crypto/BlockedIOStreamTest.java
index 6d10aff..ed1a708 100644
--- a/core/src/test/java/org/apache/accumulo/core/crypto/BlockedIOStreamTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/crypto/BlockedIOStreamTest.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.core.crypto;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -31,7 +31,7 @@ import java.util.Arrays;
import org.apache.accumulo.core.crypto.streams.BlockedInputStream;
import org.apache.accumulo.core.crypto.streams.BlockedOutputStream;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BlockedIOStreamTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java b/core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java
index d97fdb5..509d537 100644
--- a/core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java
@@ -20,11 +20,11 @@ package org.apache.accumulo.core.crypto;
import static org.apache.accumulo.core.conf.Property.INSTANCE_CRYPTO_PREFIX;
import static org.apache.accumulo.core.crypto.CryptoUtils.getFileDecrypter;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -71,8 +71,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterables;
@@ -89,7 +89,7 @@ public class CryptoTest {
CRYPTO_OFF, CRYPTO_ON, CRYPTO_ON_DISABLED
}
- @BeforeClass
+ @BeforeAll
public static void setupKeyFiles() throws IOException {
setupKeyFiles(CryptoTest.class);
}
@@ -435,7 +435,7 @@ public class CryptoTest {
FileEncrypter encrypter = cs.getFileEncrypter(env);
byte[] params = encrypter.getDecryptionParameters();
- assertNotNull("CryptoService returned null FileEncrypter", encrypter);
+ assertNotNull(encrypter, "CryptoService returned null FileEncrypter");
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(out);
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ArrayByteSequenceTest.java b/core/src/test/java/org/apache/accumulo/core/data/ArrayByteSequenceTest.java
index f3fe2a9..1b99ae6 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ArrayByteSequenceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/ArrayByteSequenceTest.java
@@ -18,20 +18,20 @@
*/
package org.apache.accumulo.core.data;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.nio.ByteBuffer;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ArrayByteSequenceTest {
ArrayByteSequence abs;
byte[] data;
- @Before
+ @BeforeEach
public void setUp() {
data = new byte[] {'s', 'm', 'i', 'l', 'e', 's'};
abs = new ArrayByteSequence(data);
@@ -104,8 +104,8 @@ public class ArrayByteSequenceTest {
@Test
public void testToString() {
- assertEquals("String conversion should round trip correctly", "",
- new ArrayByteSequence("").toString());
+ assertEquals("", new ArrayByteSequence("").toString(),
+ "String conversion should round trip correctly");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ByteSequenceTest.java b/core/src/test/java/org/apache/accumulo/core/data/ByteSequenceTest.java
index ac86bb3..a5c9647 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ByteSequenceTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/ByteSequenceTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.data;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ByteSequenceTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java b/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java
index 8945bc9..433956e 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.data;
-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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -30,13 +30,13 @@ import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.accumulo.core.dataImpl.thrift.TColumn;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class ColumnTest {
static Column[] col;
- @BeforeClass
+ @BeforeAll
public static void setup() {
col = new Column[5];
col[0] = new Column("colfam".getBytes(), "colq".getBytes(), "colv".getBytes());
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 734de15..5f9e7f9 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
@@ -19,17 +19,17 @@
package org.apache.accumulo.core.data;
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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ConditionTest {
private static final ByteSequence EMPTY = new ArrayByteSequence(new byte[0]);
@@ -50,7 +50,7 @@ public class ConditionTest {
private Condition c;
- @Before
+ @BeforeEach
public void setUp() {
c = new Condition(FAMILY, QUALIFIER);
}
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 5848290..5d9ebdf 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
@@ -19,17 +19,17 @@
package org.apache.accumulo.core.data;
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 static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ConditionalMutationTest {
private static final byte[] ROW = "row".getBytes(UTF_8);
@@ -41,7 +41,7 @@ public class ConditionalMutationTest {
private Condition c1, c2;
private ConditionalMutation cm;
- @Before
+ @BeforeEach
public void setUp() {
c1 = new Condition(FAMILY, QUALIFIER);
c2 = new Condition(FAMILY, QUALIFIER2);
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ConstraintViolationSummaryTest.java b/core/src/test/java/org/apache/accumulo/core/data/ConstraintViolationSummaryTest.java
index e00b078..254d128 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ConstraintViolationSummaryTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/ConstraintViolationSummaryTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.data;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ConstraintViolationSummaryTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/data/KeyBuilderTest.java b/core/src/test/java/org/apache/accumulo/core/data/KeyBuilderTest.java
index 70f02e5..13f3441 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/KeyBuilderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/KeyBuilderTest.java
@@ -19,13 +19,13 @@
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.assertNotEquals;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class KeyBuilderTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/data/KeyExtentTest.java b/core/src/test/java/org/apache/accumulo/core/data/KeyExtentTest.java
index 44272b5..0399e33 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/KeyExtentTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/KeyExtentTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.data;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -33,7 +33,7 @@ import java.util.TreeMap;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class KeyExtentTest {
KeyExtent nke(String t, String er, String per) {
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 e14d219..312d283 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
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.core.data;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Iterator;
@@ -33,7 +33,7 @@ import org.apache.accumulo.core.dataImpl.thrift.TKey;
import org.apache.accumulo.core.dataImpl.thrift.TKeyValue;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class KeyTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/data/LoadPlanTest.java b/core/src/test/java/org/apache/accumulo/core/data/LoadPlanTest.java
index 52d298b..ecbe60f 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/LoadPlanTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/LoadPlanTest.java
@@ -20,8 +20,8 @@ package org.apache.accumulo.core.data;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.stream.Collectors.toSet;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.HashSet;
import java.util.Set;
@@ -29,7 +29,7 @@ import java.util.Set;
import org.apache.accumulo.core.data.LoadPlan.Destination;
import org.apache.accumulo.core.data.LoadPlan.RangeType;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class LoadPlanTest {
@Test
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 7cec916..d69f852 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,12 +19,12 @@
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.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -38,7 +38,7 @@ import java.util.List;
import org.apache.accumulo.core.dataImpl.thrift.TMutation;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MutationTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/data/NamespaceIdTest.java b/core/src/test/java/org/apache/accumulo/core/data/NamespaceIdTest.java
index f98ad84..73fc653 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/NamespaceIdTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/NamespaceIdTest.java
@@ -18,28 +18,25 @@
*/
package org.apache.accumulo.core.data;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.apache.accumulo.core.WithTestNames;
import org.apache.accumulo.core.clientImpl.Namespace;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Tests the NamespaceId class, mainly the internal cache.
*/
-public class NamespaceIdTest {
+public class NamespaceIdTest extends WithTestNames {
private static final Logger LOG = LoggerFactory.getLogger(NamespaceIdTest.class);
- @Rule
- public TestName name = new TestName();
-
private static long cacheCount() {
// guava cache size() is approximate, and can include garbage-collected entries
// so we iterate to get the actual cache size
@@ -52,7 +49,7 @@ public class NamespaceIdTest {
// NamespaceId, and aren't preloaded when the NamespaceId class is referenced
assertNotSame(Namespace.ACCUMULO.id(), Namespace.DEFAULT.id());
- String namespaceString = "namespace-" + name.getMethodName();
+ String namespaceString = "namespace-" + testName();
long initialSize = cacheCount();
NamespaceId nsId = NamespaceId.of(namespaceString);
assertEquals(initialSize + 1, cacheCount());
@@ -71,7 +68,8 @@ public class NamespaceIdTest {
assertSame(nsId, nsId2);
}
- @Test(timeout = 30_000)
+ @Test
+ @Timeout(30_000)
public void testCacheIncreasesAndDecreasesAfterGC() {
long initialSize = cacheCount();
assertTrue(initialSize < 20); // verify initial amount is reasonably low
@@ -79,7 +77,7 @@ public class NamespaceIdTest {
LOG.info(NamespaceId.cache.asMap().toString());
// add one and check increase
- String namespaceString = "namespace-" + name.getMethodName();
+ String namespaceString = "namespace-" + testName();
NamespaceId nsId = NamespaceId.of(namespaceString);
assertEquals(initialSize + 1, cacheCount());
assertEquals(namespaceString, nsId.canonical());
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 3b2f6e5..8179146 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
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.data;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -36,7 +36,7 @@ import java.util.List;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.dataImpl.thrift.TRange;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RangeTest {
private Range newRange(String k1, String k2) {
@@ -59,7 +59,7 @@ public class RangeTest {
HashSet<Range> s1 = new HashSet<>(rl);
HashSet<Range> s2 = new HashSet<>(expected);
- assertEquals("got : " + rl + " expected : " + expected, s1, s2);
+ assertEquals(s1, s2, "got : " + rl + " expected : " + expected);
}
@Test
@@ -877,8 +877,8 @@ public class RangeTest {
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
Range r2 = new Range();
try (DataInputStream dis = new DataInputStream(bais)) {
- assertThrows("readFields allowed invalid range", InvalidObjectException.class,
- () -> r2.readFields(dis));
+ assertThrows(InvalidObjectException.class, () -> r2.readFields(dis),
+ "readFields allowed invalid range");
}
}
@@ -895,7 +895,7 @@ public class RangeTest {
Range r =
new Range(new Key(new Text("soup")), true, false, new Key(new Text("nuts")), true, false);
TRange tr = r.toThrift();
- assertThrows("Thrift constructor allowed invalid range", IllegalArgumentException.class,
- () -> new Range(tr));
+ assertThrows(IllegalArgumentException.class, () -> new Range(tr),
+ "Thrift constructor allowed invalid range");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/data/TableIdTest.java b/core/src/test/java/org/apache/accumulo/core/data/TableIdTest.java
index 2102e32..16810ae 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/TableIdTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/TableIdTest.java
@@ -18,17 +18,17 @@
*/
package org.apache.accumulo.core.data;
-import static org.junit.Assert.assertEquals;
-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 static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.apache.accumulo.core.WithTestNames;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.RootTable;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,13 +37,10 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Tests the Table ID class, mainly the internal cache.
*/
-public class TableIdTest {
+public class TableIdTest extends WithTestNames {
private static final Logger LOG = LoggerFactory.getLogger(TableIdTest.class);
- @Rule
- public TestName name = new TestName();
-
private static long cacheCount() {
// guava cache size() is approximate, and can include garbage-collected entries
// so we iterate to get the actual cache size
@@ -61,7 +58,7 @@ public class TableIdTest {
assertNotSame(RootTable.ID, MetadataTable.ID);
assertNotSame(RootTable.ID, REPL_TABLE_ID);
- String tableString = "table-" + name.getMethodName();
+ String tableString = "table-" + testName();
long initialSize = cacheCount();
TableId table1 = TableId.of(tableString);
assertEquals(initialSize + 1, cacheCount());
@@ -83,7 +80,8 @@ public class TableIdTest {
assertSame(table1, table2);
}
- @Test(timeout = 30_000)
+ @Test
+ @Timeout(30_000)
public void testCacheIncreasesAndDecreasesAfterGC() {
long initialSize = cacheCount();
assertTrue(initialSize < 20); // verify initial amount is reasonably low
@@ -91,7 +89,7 @@ public class TableIdTest {
LOG.info(TableId.cache.asMap().toString());
// add one and check increase
- String tableString = "table-" + name.getMethodName();
+ String tableString = "table-" + testName();
TableId table1 = TableId.of(tableString);
assertEquals(initialSize + 1, cacheCount());
assertEquals(tableString, table1.canonical());
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 97f8921..16b966c 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
@@ -22,13 +22,13 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.easymock.EasyMock.createMock;
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.assertNotEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -37,8 +37,8 @@ import java.io.DataOutputStream;
import java.nio.ByteBuffer;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ValueTest {
private static final byte[] toBytes(String s) {
@@ -51,7 +51,7 @@ public class ValueTest {
DATABUFF.put(DATA);
}
- @Before
+ @BeforeEach
public void setUp() {
DATABUFF.rewind();
}
diff --git a/core/src/test/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java
index 68cb8b7..fc249c2 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.data.constraints;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collections;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DefaultKeySizeConstraintTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/data/constraints/NoDeleteConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/data/constraints/NoDeleteConstraintTest.java
index 0523874..a0a45a6 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/constraints/NoDeleteConstraintTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/constraints/NoDeleteConstraintTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.data.constraints;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.List;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class NoDeleteConstraintTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/data/constraints/VisibilityConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/data/constraints/VisibilityConstraintTest.java
index 893f0ae..8acd9fe 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/constraints/VisibilityConstraintTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/constraints/VisibilityConstraintTest.java
@@ -23,8 +23,8 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.Arrays;
import java.util.List;
@@ -34,8 +34,8 @@ import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.constraints.Constraint.Environment;
import org.apache.accumulo.core.security.AuthorizationContainer;
import org.apache.accumulo.core.security.ColumnVisibility;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class VisibilityConstraintTest {
@@ -50,7 +50,7 @@ public class VisibilityConstraintTest {
static final List<Short> ENOAUTH = Arrays.asList((short) 2);
- @Before
+ @BeforeEach
public void setUp() {
vc = new VisibilityConstraint();
mutation = new Mutation("r");
@@ -69,33 +69,33 @@ public class VisibilityConstraintTest {
@Test
public void testNoVisibility() {
mutation.put(D, D, D);
- assertNull("authorized", vc.check(env, mutation));
+ assertNull(vc.check(env, mutation), "authorized");
}
@Test
public void testVisibilityNoAuth() {
mutation.put(D, D, bad, D);
- assertEquals("unauthorized", ENOAUTH, vc.check(env, mutation));
+ assertEquals(ENOAUTH, vc.check(env, mutation), "unauthorized");
}
@Test
public void testGoodVisibilityAuth() {
mutation.put(D, D, good, D);
- assertNull("authorized", vc.check(env, mutation));
+ assertNull(vc.check(env, mutation), "authorized");
}
@Test
public void testCachedVisibilities() {
mutation.put(D, D, good, "v");
mutation.put(D, D, good, "v2");
- assertNull("authorized", vc.check(env, mutation));
+ assertNull(vc.check(env, mutation), "authorized");
}
@Test
public void testMixedVisibilities() {
mutation.put(D, D, bad, D);
mutation.put(D, D, good, D);
- assertEquals("unauthorized", ENOAUTH, vc.check(env, mutation));
+ assertEquals(ENOAUTH, vc.check(env, mutation), "unauthorized");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java b/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java
index 1ff5a5f..2e90ec7 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.file;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
+import org.apache.accumulo.core.WithTestNames;
import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
@@ -40,27 +41,22 @@ import org.apache.accumulo.core.file.rfile.RFile;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not set by user input")
-public class BloomFilterLayerLookupTest {
+public class BloomFilterLayerLookupTest extends WithTestNames {
private static final Logger log = LoggerFactory.getLogger(BloomFilterLayerLookupTest.class);
private static final SecureRandom random = new SecureRandom();
- @Rule
- public TestName testName = new TestName();
-
- @Rule
- public TemporaryFolder tempDir =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static final File tempDir = new File(System.getProperty("user.dir") + "/target",
+ BloomFilterLayerLookupTest.class.getSimpleName() + "/");
@Test
public void test() throws IOException {
@@ -84,7 +80,7 @@ public class BloomFilterLayerLookupTest {
// get output file name
String suffix = FileOperations.getNewFileExtension(acuconf);
- String fname = new File(tempDir.getRoot(), testName + "." + suffix).getAbsolutePath();
+ String fname = new File(tempDir, testName() + "." + suffix).getAbsolutePath();
FileSKVWriter bmfw = FileOperations.getInstance().newWriterBuilder()
.forFile(fname, fs, conf, CryptoServiceFactory.newDefaultInstance())
.withTableConfiguration(acuconf).build();
diff --git a/core/src/test/java/org/apache/accumulo/core/file/FileOperationsTest.java b/core/src/test/java/org/apache/accumulo/core/file/FileOperationsTest.java
index ba62d3e..7a31c58 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/FileOperationsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/FileOperationsTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.file;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.io.File;
import java.io.IOException;
@@ -30,7 +30,7 @@ import org.apache.accumulo.core.file.rfile.RFile;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FileOperationsTest {
@@ -65,6 +65,6 @@ public class FileOperationsTest {
FileUtils.forceDelete(testFile);
}
- assertFalse("Should not throw with more than 1 dot in filename.", caughtException);
+ assertFalse(caughtException, "Should not throw with more than 1 dot in filename.");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
index eed8386..e3392c7 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheFactoryTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.file.blockfile.cache;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.conf.DefaultConfiguration;
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheManager;
import org.apache.accumulo.core.file.blockfile.cache.tinylfu.TinyLfuBlockCacheManager;
import org.apache.accumulo.core.spi.cache.BlockCacheManager;
import org.apache.accumulo.core.spi.cache.CacheType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BlockCacheFactoryTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheManagerTest.java b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheManagerTest.java
index 2a04689..7324592 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheManagerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/BlockCacheManagerTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.file.blockfile.cache;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.accumulo.core.spi.cache.BlockCacheManager;
import org.apache.accumulo.core.spi.cache.CacheType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BlockCacheManagerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestCachedBlockQueue.java b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestCachedBlockQueue.java
index 2db8d83..69ce877 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestCachedBlockQueue.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestCachedBlockQueue.java
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.core.file.blockfile.cache;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.LinkedList;
import org.apache.accumulo.core.file.blockfile.cache.lru.CachedBlockQueue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestCachedBlockQueue {
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 df11afe..62cd4fc 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
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.file.blockfile.cache;
-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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.security.SecureRandom;
import java.util.Arrays;
@@ -41,7 +41,7 @@ import org.apache.accumulo.core.file.blockfile.cache.lru.LruBlockCacheManager;
import org.apache.accumulo.core.spi.cache.BlockCacheManager;
import org.apache.accumulo.core.spi.cache.CacheEntry;
import org.apache.accumulo.core.spi.cache.CacheType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests the concurrent LruBlockCache.
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/BlockIndexTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/BlockIndexTest.java
index b3e84e1..c33e8bf 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/BlockIndexTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/BlockIndexTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.file.rfile;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@@ -33,7 +33,7 @@ import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile;
import org.apache.accumulo.core.file.rfile.BlockIndex.BlockIndexEntry;
import org.apache.accumulo.core.file.rfile.MultiLevelIndex.IndexEntry;
import org.apache.accumulo.core.spi.cache.CacheEntry;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BlockIndexTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/GenerateSplitsTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/GenerateSplitsTest.java
index 9c7ba83..beb3102 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/GenerateSplitsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/GenerateSplitsTest.java
@@ -23,9 +23,9 @@ import static org.apache.accumulo.core.file.rfile.GenerateSplits.main;
import static org.apache.accumulo.core.file.rfile.RFileTest.newColFamByteSequence;
import static org.apache.accumulo.core.file.rfile.RFileTest.newKey;
import static org.apache.accumulo.core.file.rfile.RFileTest.newValue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileNotFoundException;
@@ -38,10 +38,9 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,9 +50,9 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
public class GenerateSplitsTest {
private static final Logger log = LoggerFactory.getLogger(GenerateSplitsTest.class);
- @ClassRule
- public static final TemporaryFolder tempFolder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ public static final File tempFolder = new File(System.getProperty("user.dir") + "/target",
+ GenerateSplitsTest.class.getSimpleName() + "/");
private static final RFileTest.TestRFile trf = new RFileTest.TestRFile(null);
private static String rfilePath;
@@ -62,7 +61,7 @@ public class GenerateSplitsTest {
/**
* Creates a test file with 84 bytes of data and 2 Locality groups.
*/
- @BeforeClass
+ @BeforeAll
public static void createFile() throws IOException {
trf.openWriter(false);
trf.writer.startNewLocalityGroup("lg1", newColFamByteSequence("cf1", "cf2"));
@@ -75,14 +74,14 @@ public class GenerateSplitsTest {
trf.writer.append(newKey("r6", "cf4", "cq1", "L1", 55), newValue("foo6"));
trf.closeWriter();
- File file = tempFolder.newFile("testGenerateSplits.rf");
+ File file = new File(tempFolder, "testGenerateSplits.rf");
try (var fileOutputStream = new FileOutputStream(file)) {
fileOutputStream.write(trf.baos.toByteArray());
}
rfilePath = "file:" + file.getAbsolutePath();
log.info("Wrote to file {}", rfilePath);
- File splitsFile = tempFolder.newFile("testSplitsFile");
+ File splitsFile = new File(tempFolder, "testSplitsFile");
splitsFilePath = splitsFile.getAbsolutePath();
}
@@ -112,11 +111,11 @@ public class GenerateSplitsTest {
String splitsFile = Files.readString(Paths.get(splitsFilePath));
assertEquals(splits.length, splitsFile.split("\n").length);
for (String s : splits)
- assertTrue("Did not find " + s + " in: " + splitsFile, splitsFile.contains(s));
+ assertTrue(splitsFile.contains(s), "Did not find " + s + " in: " + splitsFile);
}
@Test
- public void testErrors() throws Exception {
+ public void testErrors() {
List<String> args = List.of("missingFile.rf", "-n", "2");
log.info("Invoking GenerateSplits with {}", args);
assertThrows(FileNotFoundException.class, () -> main(args.toArray(new String[0])));
@@ -124,18 +123,21 @@ public class GenerateSplitsTest {
List<String> args2 = List.of(rfilePath);
log.info("Invoking GenerateSplits with {}", args2);
var e = assertThrows(IllegalArgumentException.class, () -> main(args2.toArray(new String[0])));
- assertTrue(e.getMessage(), e.getMessage().contains("Required number of splits or"));
+ assertTrue(e.getMessage().contains("Required number of splits or"), e.getMessage());
List<String> args3 = List.of(rfilePath, "-n", "2", "-ss", "40");
log.info("Invoking GenerateSplits with {}", args3);
e = assertThrows(IllegalArgumentException.class, () -> main(args3.toArray(new String[0])));
- assertTrue(e.getMessage(), e.getMessage().contains("Requested number of splits and"));
+ assertTrue(e.getMessage().contains("Requested number of splits and"), e.getMessage());
- List<String> args4 = List.of(tempFolder.newFolder("dir1").getAbsolutePath(),
- tempFolder.newFolder("dir2").getAbsolutePath(), "-n", "2");
+ File dir1 = new File(tempFolder, "dir1/");
+ File dir2 = new File(tempFolder, "dir2/");
+ assertTrue(dir1.mkdir() && dir2.mkdir(), "Failed to make new sub-directories");
+
+ List<String> args4 = List.of(dir1.getAbsolutePath(), dir2.getAbsolutePath(), "-n", "2");
log.info("Invoking GenerateSplits with {}", args4);
e = assertThrows(IllegalArgumentException.class, () -> main(args4.toArray(new String[0])));
- assertTrue(e.getMessage(), e.getMessage().contains("No files were found"));
+ assertTrue(e.getMessage().contains("No files were found"), e.getMessage());
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java
index bdaea52..c2e8e24 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/KeyShortenerTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.file.rfile;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.accumulo.core.data.Key;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.primitives.Bytes;
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java
index ac7f61b..293d8e0 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiLevelIndexTest.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.core.file.rfile;
import static org.apache.accumulo.core.crypto.CryptoServiceFactory.ClassloaderType.JAVA;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -44,7 +44,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MultiLevelIndexTest {
private static final SecureRandom random = new SecureRandom();
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
index c91216f..6229c07 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.file.rfile;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -62,9 +62,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,10 +75,6 @@ public class MultiThreadedRFileTest {
private static final Logger LOG = LoggerFactory.getLogger(MultiThreadedRFileTest.class);
private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<>();
- @Rule
- public TemporaryFolder tempFolder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
-
private static void checkIndex(Reader reader) throws IOException {
FileSKVIterator indexIter = reader.getIndex();
@@ -301,27 +295,25 @@ public class MultiThreadedRFileTest {
for (int i = 0; i < 2048; i++) {
Key key = getKey(part, locality, i);
Value value = getValue(i);
- assertTrue("No record found for row " + part + " locality " + locality + " index " + i,
- trf.iter.hasTop());
- assertEquals(
- "Invalid key found for row " + part + " locality " + locality + " index " + i, key,
- trf.iter.getTopKey());
- assertEquals(
- "Invalid value found for row " + part + " locality " + locality + " index " + i,
- value, trf.iter.getTopValue());
+ assertTrue(trf.iter.hasTop(),
+ "No record found for row " + part + " locality " + locality + " index " + i);
+ assertEquals(key, trf.iter.getTopKey(),
+ "Invalid key found for row " + part + " locality " + locality + " index " + i);
+ assertEquals(value, trf.iter.getTopValue(),
+ "Invalid value found for row " + part + " locality " + locality + " index " + i);
last = trf.iter.getTopKey();
trf.iter.next();
}
}
if (trf.iter.hasTop()) {
- assertFalse("Found " + trf.iter.getTopKey() + " after " + last + " in " + range,
- trf.iter.hasTop());
+ assertFalse(trf.iter.hasTop(),
+ "Found " + trf.iter.getTopKey() + " after " + last + " in " + range);
}
range = new Range(getKey(4, 4, 0), true, null, true);
trf.iter.seek(range, EMPTY_COL_FAMS, false);
if (trf.iter.hasTop()) {
- assertFalse("Found " + trf.iter.getTopKey() + " in " + range, trf.iter.hasTop());
+ assertFalse(trf.iter.hasTop(), "Found " + trf.iter.getTopKey() + " in " + range);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
@@ -337,14 +329,12 @@ public class MultiThreadedRFileTest {
for (int i = 0; i < 2048; i++) {
Key key = getKey(part, locality, i);
Value value = getValue(i);
- assertTrue("No record found for row " + part + " locality " + locality + " index " + i,
- trf.iter.hasTop());
- assertEquals(
- "Invalid key found for row " + part + " locality " + locality + " index " + i, key,
- trf.iter.getTopKey());
- assertEquals(
- "Invalid value found for row " + part + " locality " + locality + " index " + i,
- value, trf.iter.getTopValue());
+ assertTrue(trf.iter.hasTop(),
+ "No record found for row " + part + " locality " + locality + " index " + i);
+ assertEquals(key, trf.iter.getTopKey(),
+ "Invalid key found for row " + part + " locality " + locality + " index " + i);
+ assertEquals(value, trf.iter.getTopValue(),
+ "Invalid value found for row " + part + " locality " + locality + " index " + i);
last = trf.iter.getTopKey();
trf.iter.next();
}
@@ -352,8 +342,8 @@ public class MultiThreadedRFileTest {
}
if (trf.iter.hasTop()) {
- assertFalse("Found " + trf.iter.getTopKey() + " after " + last + " in " + range,
- trf.iter.hasTop());
+ assertFalse(trf.iter.hasTop(),
+ "Found " + trf.iter.getTopKey() + " after " + last + " in " + range);
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileMetricsTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileMetricsTest.java
index c610d5f..8f7620f 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileMetricsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileMetricsTest.java
@@ -18,9 +18,8 @@
*/
package org.apache.accumulo.core.file.rfile;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -34,11 +33,9 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.util.LocalityGroupUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.util.concurrent.AtomicLongMap;
@@ -47,18 +44,14 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not set by user input")
public class RFileMetricsTest {
- @Rule
- public TemporaryFolder tempFolder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
-
private TestRFile trf = null;
- @Before
+ @BeforeEach
public void makeTestRFile() {
trf = new TestRFile();
}
- @After
+ @AfterEach
public void cleanUpTestRFile() {
// do our best to clean up first
if (trf != null) {
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 4c819e3..4a60290 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,12 +18,12 @@
*/
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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -90,10 +90,9 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.PositionedReadable;
import org.apache.hadoop.fs.Seekable;
import org.apache.hadoop.io.Text;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import com.google.common.hash.HashCode;
import com.google.common.hash.Hasher;
@@ -129,11 +128,11 @@ public class RFileTest {
private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<>();
private static final Configuration hadoopConf = new Configuration();
- @Rule
- public TemporaryFolder tempFolder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static final File tempFolder =
+ new File(System.getProperty("user.dir") + "/target", RFileTest.class.getSimpleName() + "/");
- @BeforeClass
+ @BeforeAll
public static void setupCryptoKeyFile() throws Exception {
CryptoTest.setupKeyFiles(RFileTest.class);
}
@@ -2229,7 +2228,7 @@ public class RFileTest {
FileSKVIterator iiter = trf.reader.getIndex();
while (iiter.hasTop()) {
Key k = iiter.getTopKey();
- assertTrue(k + " " + k.getSize() + " >= 20", k.getSize() < 20);
+ assertTrue(k.getSize() < 20, k + " " + k.getSize() + " >= 20");
iiter.next();
}
@@ -2322,7 +2321,7 @@ public class RFileTest {
if (true) {
FileOutputStream fileOutputStream =
- new FileOutputStream(tempFolder.newFile("testEncryptedRootFile.rf"));
+ new FileOutputStream(new File(tempFolder, "testEncryptedRootFile.rf"));
fileOutputStream.write(testRfile.baos.toByteArray());
fileOutputStream.flush();
fileOutputStream.close();
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RelativeKeyTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RelativeKeyTest.java
index be1bafe..dd9c0b1 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RelativeKeyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RelativeKeyTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.file.rfile;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -35,9 +35,9 @@ import org.apache.accumulo.core.data.PartialKey;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.file.rfile.RelativeKey.SkippR;
import org.apache.accumulo.core.util.MutableByteSequence;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class RelativeKeyTest {
@@ -96,7 +96,7 @@ public class RelativeKeyTest {
private static ArrayList<Integer> expectedPositions;
private static ByteArrayOutputStream baos;
- @BeforeClass
+ @BeforeAll
public static void initSource() throws IOException {
int initialListSize = 10000;
@@ -147,7 +147,7 @@ public class RelativeKeyTest {
private DataInputStream in;
- @Before
+ @BeforeEach
public void setupDataInputStream() {
in = new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));
in.mark(0);
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RollingStatsTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RollingStatsTest.java
index 089cb4f..ccf0598 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RollingStatsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RollingStatsTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.file.rfile;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.security.SecureRandom;
import java.util.function.IntSupplier;
@@ -27,7 +27,7 @@ import org.apache.commons.math3.distribution.NormalDistribution;
import org.apache.commons.math3.distribution.ZipfDistribution;
import org.apache.commons.math3.random.Well19937c;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.math.DoubleMath;
@@ -37,8 +37,8 @@ public class RollingStatsTest {
private static final SecureRandom random = new SecureRandom();
private static void assertFuzzyEquals(double expected, double actual) {
- assertTrue(String.format("expected: %f, actual: %f diff: %f", expected, actual,
- Math.abs(expected - actual)), DoubleMath.fuzzyEquals(expected, actual, TOLERANCE));
+ assertTrue(DoubleMath.fuzzyEquals(expected, actual, TOLERANCE), String.format(
+ "expected: %f, actual: %f diff: %f", expected, actual, Math.abs(expected - actual)));
}
private static void checkAgreement(DescriptiveStatistics ds, RollingStats rs) {
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/bcfile/CompressionTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/bcfile/CompressionTest.java
index 84443c8..09b38d1 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/bcfile/CompressionTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/bcfile/CompressionTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.file.rfile.bcfile;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.HashMap;
@@ -37,14 +37,15 @@ import org.apache.accumulo.core.file.rfile.bcfile.Compression.Algorithm;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.util.ReflectionUtils;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
public class CompressionTest {
HashMap<Compression.Algorithm,Boolean> isSupported = new HashMap<>();
- @Before
+ @BeforeEach
public void testSupport() {
// we can safely assert that GZ exists by virtue of it being the DefaultCodec
isSupported.put(Compression.Algorithm.GZ, true);
@@ -129,11 +130,11 @@ public class CompressionTest {
if (isSupported.get(al) != null && isSupported.get(al)) {
// first call to isSupported should be true
- assertTrue(al + " is not supported, but should be", al.isSupported());
+ assertTrue(al.isSupported(), al + " is not supported, but should be");
- assertNotNull(al + " should have a non-null codec", al.getCodec());
+ assertNotNull(al.getCodec(), al + " should have a non-null codec");
- assertNotNull(al + " should have a non-null codec", al.getCodec());
+ assertNotNull(al.getCodec(), al + " should have a non-null codec");
}
}
}
@@ -144,31 +145,32 @@ public class CompressionTest {
for (final Algorithm al : Algorithm.values()) {
if (isSupported.get(al) != null && isSupported.get(al)) {
- assertTrue(al + " is not supported, but should be", al.isSupported());
+ assertTrue(al.isSupported(), al + " is not supported, but should be");
- assertNotNull(al + " should have a non-null codec", al.getCodec());
+ assertNotNull(al.getCodec(), al + " should have a non-null codec");
// assert that additional calls to create will not create
// additional codecs
- assertNotEquals(al + " should have created a new codec, but did not",
- System.identityHashCode(al.getCodec()), al.createNewCodec(88 * 1024));
+ assertNotEquals(System.identityHashCode(al.getCodec()), al.createNewCodec(88 * 1024),
+ al + " should have created a new codec, but did not");
}
}
}
- @Test(timeout = 60_000)
+ @Test
+ @Timeout(60_000)
public void testManyStartNotNull() throws InterruptedException, ExecutionException {
for (final Algorithm al : Algorithm.values()) {
if (isSupported.get(al) != null && isSupported.get(al)) {
// first call to isSupported should be true
- assertTrue(al + " is not supported, but should be", al.isSupported());
+ assertTrue(al.isSupported(), al + " is not supported, but should be");
final CompressionCodec codec = al.getCodec();
- assertNotNull(al + " should not be null", codec);
+ assertNotNull(codec, al + " should not be null");
ExecutorService service = Executors.newFixedThreadPool(10);
@@ -176,22 +178,22 @@ public class CompressionTest {
for (int i = 0; i < 30; i++) {
results.add(service.submit(() -> {
- assertNotNull(al + " should not be null", al.getCodec());
+ assertNotNull(al.getCodec(), al + " should not be null");
return true;
}));
}
service.shutdown();
- assertNotNull(al + " should not be null", codec);
+ assertNotNull(codec, al + " should not be null");
while (!service.awaitTermination(1, TimeUnit.SECONDS)) {
// wait
}
for (Future<Boolean> result : results) {
- assertTrue(al + " resulted in a failed call to getcodec within the thread pool",
- result.get());
+ assertTrue(result.get(),
+ al + " resulted in a failed call to getcodec within the thread pool");
}
}
}
@@ -199,14 +201,15 @@ public class CompressionTest {
}
// don't start until we have created the codec
- @Test(timeout = 60_000)
+ @Test
+ @Timeout(60_000)
public void testManyDontStartUntilThread() throws InterruptedException, ExecutionException {
for (final Algorithm al : Algorithm.values()) {
if (isSupported.get(al) != null && isSupported.get(al)) {
// first call to isSupported should be true
- assertTrue(al + " is not supported, but should be", al.isSupported());
+ assertTrue(al.isSupported(), al + " is not supported, but should be");
ExecutorService service = Executors.newFixedThreadPool(10);
@@ -215,7 +218,7 @@ public class CompressionTest {
for (int i = 0; i < 30; i++) {
results.add(service.submit(() -> {
- assertNotNull(al + " should have a non-null codec", al.getCodec());
+ assertNotNull(al.getCodec(), al + " should have a non-null codec");
return true;
}));
}
@@ -227,22 +230,23 @@ public class CompressionTest {
}
for (Future<Boolean> result : results) {
- assertTrue(al + " resulted in a failed call to getcodec within the thread pool",
- result.get());
+ assertTrue(result.get(),
+ al + " resulted in a failed call to getcodec within the thread pool");
}
}
}
}
- @Test(timeout = 60_000)
+ @Test
+ @Timeout(60_000)
public void testThereCanBeOnlyOne() throws InterruptedException, ExecutionException {
for (final Algorithm al : Algorithm.values()) {
if (isSupported.get(al) != null && isSupported.get(al)) {
// first call to isSupported should be true
- assertTrue(al + " is not supported, but should be", al.isSupported());
+ assertTrue(al.isSupported(), al + " is not supported, but should be");
ExecutorService service = Executors.newFixedThreadPool(20);
@@ -256,7 +260,7 @@ public class CompressionTest {
for (int i = 0; i < 40; i++) {
list.add(() -> {
CompressionCodec codec = al.getCodec();
- assertNotNull(al + " resulted in a non-null codec", codec);
+ assertNotNull(codec, al + " resulted in a non-null codec");
// add the identity hashcode to the set.
synchronized (testSet) {
testSet.add(System.identityHashCode(codec));
@@ -267,7 +271,7 @@ public class CompressionTest {
results.addAll(service.invokeAll(list));
// ensure that we
- assertEquals(al + " created too many codecs", 1, testSet.size());
+ assertEquals(1, testSet.size(), al + " created too many codecs");
service.shutdown();
while (!service.awaitTermination(1, TimeUnit.SECONDS)) {
@@ -275,8 +279,8 @@ public class CompressionTest {
}
for (Future<Boolean> result : results) {
- assertTrue(al + " resulted in a failed call to getcodec within the thread pool",
- result.get());
+ assertTrue(result.get(),
+ al + " resulted in a failed call to getcodec within the thread pool");
}
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/file/streams/RateLimitedInputStreamTest.java b/core/src/test/java/org/apache/accumulo/core/file/streams/RateLimitedInputStreamTest.java
index 1c5651c..dfcb729 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/streams/RateLimitedInputStreamTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/streams/RateLimitedInputStreamTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.file.streams;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.InputStream;
import java.security.SecureRandom;
@@ -27,7 +27,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.accumulo.core.util.ratelimit.RateLimiter;
import org.apache.hadoop.fs.Seekable;
import org.easymock.EasyMock;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RateLimitedInputStreamTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/file/streams/RateLimitedOutputStreamTest.java b/core/src/test/java/org/apache/accumulo/core/file/streams/RateLimitedOutputStreamTest.java
index 5ca298f..4cafe82 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/streams/RateLimitedOutputStreamTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/streams/RateLimitedOutputStreamTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.file.streams;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.OutputStream;
import java.security.SecureRandom;
@@ -27,7 +27,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.accumulo.core.util.ratelimit.RateLimiter;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.easymock.EasyMock;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.io.CountingOutputStream;
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowIteratorTest.java
index 987f8d7..e8e7958 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowIteratorTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.iterators;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.Set;
@@ -32,7 +32,7 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iteratorsImpl.system.CountingIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FirstEntryInRowIteratorTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowTest.java
index a076282..ead7b29 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/FirstEntryInRowTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.iterators;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.HashMap;
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FirstEntryInRowTest {
private static final Map<String,String> EMPTY_MAP = new HashMap<>();
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/SortedMapIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/SortedMapIteratorTest.java
index 1ed0fa8..eddbc77 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/SortedMapIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/SortedMapIteratorTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.iterators;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.TreeMap;
@@ -26,7 +26,7 @@ import org.apache.accumulo.core.client.SampleNotPresentException;
import org.apache.accumulo.core.client.sample.RowSampler;
import org.apache.accumulo.core.client.sample.SamplerConfiguration;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SortedMapIteratorTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
index 702c0a9..cda8208 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.iterators.system;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
import java.util.HashSet;
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.iteratorsImpl.system.ColumnFamilySkippingIterato
import org.apache.accumulo.core.iteratorsImpl.system.CountingIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ColumnFamilySkippingIteratorTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java
index a88e56a..0584535 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFilterTest.java
@@ -18,10 +18,10 @@
*/
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 static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collections;
import java.util.HashSet;
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iteratorsImpl.system.ColumnQualifierFilter;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ColumnFilterTest {
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 2ce9e97..f67cd91 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
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.iterators.system;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.ArrayList;
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.iteratorsImpl.system.DeletingIterator;
import org.apache.accumulo.core.iteratorsImpl.system.DeletingIterator.Behavior;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DeletingIteratorTest {
@@ -71,7 +71,7 @@ public class DeletingIteratorTest {
tm.put(k, dvNew);
}
}
- assertEquals("Initial size was " + tm.size(), 21, tm.size());
+ assertEquals(21, tm.size(), "Initial size was " + tm.size());
Text checkRow = new Text("000");
try {
@@ -84,7 +84,7 @@ public class DeletingIteratorTest {
tmOut.put(it.getTopKey(), it.getTopValue());
it.next();
}
- assertEquals("size after no propagation was " + tmOut.size(), 15, tmOut.size());
+ assertEquals(15, tmOut.size(), "size after no propagation was " + tmOut.size());
for (Entry<Key,Value> e : tmOut.entrySet()) {
if (e.getKey().getRow().equals(checkRow)) {
byte[] b = e.getValue().get();
@@ -106,7 +106,7 @@ public class DeletingIteratorTest {
tmOut.put(it.getTopKey(), it.getTopValue());
it.next();
}
- assertEquals("size after propagation was " + tmOut.size(), 16, tmOut.size());
+ assertEquals(16, tmOut.size(), "size after propagation was " + tmOut.size());
for (Entry<Key,Value> e : tmOut.entrySet()) {
if (e.getKey().getRow().equals(checkRow)) {
byte[] b = e.getValue().get();
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 81ae115..097d096 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
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.iterators.system;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iteratorsImpl.system.MultiIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MultiIteratorTest {
@@ -107,9 +107,10 @@ public class MultiIteratorTest {
i--;
}
- assertEquals("start=" + start + " end=" + end + " seekKey=" + seekKey + " endRow=" + endRow
- + " prevEndRow=" + prevEndRow + " init=" + init + " incrRow=" + incrRow + " maps=" + maps,
- end, i);
+ assertEquals(end, i,
+ "start=" + start + " end=" + end + " seekKey=" + seekKey + " endRow=" + endRow
+ + " prevEndRow=" + prevEndRow + " init=" + init + " incrRow=" + incrRow + " maps="
+ + maps);
}
void verify(int start, Key seekKey, List<TreeMap<Key,Value>> maps) throws IOException {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
index 6d908f1..711eac4 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/SourceSwitchingIteratorTest.java
@@ -18,11 +18,11 @@
*/
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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -47,7 +47,7 @@ import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SourceSwitchingIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SourceSwitchingIterator.DataSource;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SourceSwitchingIteratorTest {
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 c1a89b6..0b3619f 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,10 +18,10 @@
*/
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 static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.HashSet;
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.accumulo.core.iteratorsImpl.system.TimeSettingIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TimeSettingIteratorTest {
@@ -110,7 +110,7 @@ public class TimeSettingIteratorTest {
assertTrue(tsi.hasTop());
final Key topKey = tsi.getTopKey();
- assertSame("Expected the topKey to be the same object", k, topKey);
+ assertSame(k, topKey, "Expected the topKey to be the same object");
assertEquals(new Key("r0", "cf1", "cq1", 50L), topKey);
assertEquals("v0", tsi.getTopValue().toString());
tsi.next();
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/VisibilityFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/VisibilityFilterTest.java
index c186f46..34ca870 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/VisibilityFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/VisibilityFilterTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.iterators.system;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.HashSet;
@@ -33,7 +33,7 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.accumulo.core.iteratorsImpl.system.VisibilityFilter;
import org.apache.accumulo.core.security.Authorizations;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class VisibilityFilterTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java
index 521c5fe..e0ebd94 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/BigDecimalCombinerTest.java
@@ -18,9 +18,9 @@
*/
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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.math.BigDecimal;
@@ -39,8 +39,8 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.Combiner;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class BigDecimalCombinerTest {
@@ -52,7 +52,7 @@ public class BigDecimalCombinerTest {
List<Column> columns;
Combiner ai;
- @Before
+ @BeforeEach
public void setup() {
encoder = new BigDecimalCombiner.BigDecimalEncoder();
tm1 = new TreeMap<>();
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 098ac0d..2434d67 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
@@ -18,10 +18,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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -38,8 +38,8 @@ import org.apache.accumulo.core.iterators.DefaultIteratorEnvironment;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ColumnSliceFilterTest {
@@ -69,7 +69,7 @@ public class ColumnSliceFilterTest {
return new Key(new Text(row), new Text(cf), new Text(cq));
}
- @Before
+ @BeforeEach
public void setUp() {
columnSliceFilter.describeOptions();
iteratorEnvironment = new DefaultIteratorEnvironment();
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 62b605c..604abe6 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
@@ -18,10 +18,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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -53,7 +53,7 @@ import org.apache.accumulo.core.iterators.ValueFormatException;
import org.apache.accumulo.core.iteratorsImpl.system.MultiIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CombinerTest {
@@ -870,9 +870,9 @@ public class CombinerTest {
long logSize = CombinerTestUtil.cacheSize();
if (expectedLog) {
- assertTrue("Expected >0 log messages, but got : " + logSize, logSize > 0);
+ assertTrue(logSize > 0, "Expected >0 log messages, but got : " + logSize);
} else {
- assertEquals("Expected 0 log messages, but got : " + logSize, 0, logSize);
+ assertEquals(0, logSize, "Expected 0 log messages, but got : " + logSize);
}
}
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 58249c0..1051e76 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,9 +18,9 @@
*/
package org.apache.accumulo.core.iterators.user;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.text.ParseException;
@@ -48,7 +48,7 @@ import org.apache.accumulo.core.iteratorsImpl.system.VisibilityFilter;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FilterTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/GrepIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/GrepIteratorTest.java
index 8241faf..b38a25d 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/GrepIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/GrepIteratorTest.java
@@ -18,9 +18,9 @@
*/
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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -36,15 +36,15 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class GrepIteratorTest {
private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<>();
SortedMap<Key,Value> input;
SortedMap<Key,Value> output;
- @Before
+ @BeforeEach
public void init() {
input = new TreeMap<>();
output = new TreeMap<>();
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 837ea98..35a53c3 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
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.iterators.user;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.security.SecureRandom;
@@ -42,7 +42,7 @@ import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iteratorsImpl.system.MultiIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class IndexedDocIteratorTest {
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 c8d1e5d..78a3b74 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
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.iterators.user;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.security.SecureRandom;
@@ -39,9 +39,7 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iteratorsImpl.system.MultiIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
public class IntersectingIteratorTest {
@@ -123,9 +121,6 @@ public class IntersectingIteratorTest {
private static final int NUM_ROWS = 10;
private static final int NUM_DOCIDS = 1000;
- @Rule
- public TestName test = new TestName();
-
@Test
public void test1() throws IOException {
columnFamilies = new Text[2];
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java
index f6cd3cc..e573143 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/LargeRowFilterTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.iterators.user;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.io.IOException;
import java.util.HashSet;
@@ -36,7 +36,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.iteratorsImpl.system.ColumnFamilySkippingIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class LargeRowFilterTest {
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 95a0b9e..98e728b 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
@@ -19,9 +19,9 @@
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;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -36,7 +36,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.DefaultIteratorEnvironment;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RegExFilterTest {
@@ -265,6 +265,6 @@ public class RegExFilterTest {
filter.init(new SortedMapIterator(tm), is.getOptions(), null);
filter.seek(new Range(), EMPTY_COL_FAMS, false);
- assertTrue("iterator couldn't find a match when it should have", filter.hasTop());
+ assertTrue(filter.hasTop(), "iterator couldn't find a match when it should have");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
index 17ad47b..07328ab 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowDeletingIteratorTest.java
@@ -18,9 +18,9 @@
*/
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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.HashSet;
@@ -36,7 +36,7 @@ import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.iteratorsImpl.system.ColumnFamilySkippingIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RowDeletingIteratorTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowEncodingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowEncodingIteratorTest.java
index bb33965..0f2c0ae 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowEncodingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowEncodingIteratorTest.java
@@ -18,10 +18,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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -42,7 +42,7 @@ import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.IteratorUtil;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RowEncodingIteratorTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
index 59983cb..b1356dd 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.iterators.user;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.Collections;
@@ -41,7 +41,7 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iteratorsImpl.system.ColumnFamilySkippingIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RowFilterTest {
@@ -269,7 +269,7 @@ public class RowFilterTest {
// Because it's a copy, we should be able to safely seek this one without affecting the original
copy.seek(new Range(), Collections.emptySet(), false);
- assertTrue("deepCopy'ed RowFilter did not have a top key", copy.hasTop());
+ assertTrue(copy.hasTop(), "deepCopy'ed RowFilter did not have a top key");
Key firstKeyFromCopy = copy.getTopKey();
Value firstValueFromCopy = copy.getTopValue();
@@ -282,8 +282,8 @@ public class RowFilterTest {
Key finalKeyRead = filter.getTopKey();
// Make sure we got a Key that was greater than the last Key we read from the original RowFilter
- assertTrue("Expected next key read to be greater than the previous after deepCopy",
- lastKeyRead.compareTo(finalKeyRead) < 0);
+ assertTrue(lastKeyRead.compareTo(finalKeyRead) < 0,
+ "Expected next key read to be greater than the previous after deepCopy");
}
private HashSet<String> getRows(RowFilter filter) throws IOException {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/TestCfCqSlice.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/TestCfCqSlice.java
index 1de3d4b..76d98a6 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/TestCfCqSlice.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/TestCfCqSlice.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.core.iterators.user;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.security.SecureRandom;
import java.util.Collections;
@@ -39,9 +39,9 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.ValueFormatException;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public abstract class TestCfCqSlice {
@@ -60,12 +60,12 @@ public abstract class TestCfCqSlice {
private static TreeMap<Key,Value> data;
- @BeforeClass
+ @BeforeAll
public static void setupData() {
data = createMap(LR_DIM, LR_DIM, LR_DIM);
}
- @AfterClass
+ @AfterAll
public static void clearData() {
data = null;
}
@@ -77,8 +77,8 @@ public abstract class TestCfCqSlice {
for (int i = 0; i < LR_DIM; i++) {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
}
}
}
@@ -93,12 +93,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (rowId == i) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -112,10 +111,10 @@ public abstract class TestCfCqSlice {
long sliceMinCq = 30;
long sliceMaxCf = 25;
long sliceMaxCq = 35;
- assertTrue("slice param must be less than LR_DIM", sliceMinCf < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMinCq < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMaxCf < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMaxCq < LR_DIM);
+ assertTrue(sliceMinCf < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMinCq < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMaxCf < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMaxCq < LR_DIM, "slice param must be less than LR_DIM");
Map<String,String> opts = new HashMap<>();
opts.put(CfCqSliceOpts.OPT_MIN_CF, new String(LONG_LEX.encode(sliceMinCf), UTF_8));
opts.put(CfCqSliceOpts.OPT_MIN_CQ, new String(LONG_LEX.encode(sliceMinCq), UTF_8));
@@ -126,12 +125,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (j >= sliceMinCf && j <= sliceMaxCf && k >= sliceMinCq && k <= sliceMaxCq) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -155,12 +153,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (j == sliceMinCf && k == sliceMinCq) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -186,12 +183,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (j == 21 && k == 21) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -211,12 +207,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (k >= sliceMinCq && k <= sliceMaxCq) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -236,12 +231,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (j >= sliceMinCf && j <= sliceMaxCf) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -266,8 +260,8 @@ public abstract class TestCfCqSlice {
for (int i = 0; i < LR_DIM; i++) {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
- assertFalse("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -282,10 +276,10 @@ public abstract class TestCfCqSlice {
long sliceMaxCf = 25;
long sliceMinCq = 30;
long sliceMaxCq = 35;
- assertTrue("slice param must be less than LR_DIM", sliceMinCf < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMinCq < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMaxCf < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMaxCq < LR_DIM);
+ assertTrue(sliceMinCf < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMinCq < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMaxCf < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMaxCq < LR_DIM, "slice param must be less than LR_DIM");
firstOpts.put(CfCqSliceOpts.OPT_MIN_CF, new String(LONG_LEX.encode(sliceMinCf), UTF_8));
firstOpts.put(CfCqSliceOpts.OPT_MAX_CF, new String(LONG_LEX.encode(sliceMaxCf), UTF_8));
secondOpts.put(CfCqSliceOpts.OPT_MIN_CQ, new String(LONG_LEX.encode(sliceMinCq), UTF_8));
@@ -298,12 +292,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (j >= sliceMinCf && j <= sliceMaxCf && k >= sliceMinCq && k <= sliceMaxCq) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -317,10 +310,10 @@ public abstract class TestCfCqSlice {
long sliceMinCq = 30;
long sliceMaxCf = 25;
long sliceMaxCq = 35;
- assertTrue("slice param must be less than LR_DIM", sliceMinCf < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMinCq < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMaxCf < LR_DIM);
- assertTrue("slice param must be less than LR_DIM", sliceMaxCq < LR_DIM);
+ assertTrue(sliceMinCf < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMinCq < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMaxCf < LR_DIM, "slice param must be less than LR_DIM");
+ assertTrue(sliceMaxCq < LR_DIM, "slice param must be less than LR_DIM");
Map<String,String> opts = new HashMap<>();
opts.put(CfCqSliceOpts.OPT_MIN_CF, new String(LONG_LEX.encode(sliceMinCf), UTF_8));
opts.put(CfCqSliceOpts.OPT_MIN_INCLUSIVE, "false");
@@ -334,12 +327,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (j > sliceMinCf && j <= sliceMaxCf && k > sliceMinCq && k <= sliceMaxCq) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -357,12 +349,11 @@ public abstract class TestCfCqSlice {
for (int j = 0; j < LR_DIM; j++) {
for (int k = 0; k < LR_DIM; k++) {
if (j > sliceMinCf && j <= sliceMaxCf && k > sliceMinCq && k <= sliceMaxCq) {
- assertTrue("(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan",
- foundKvs[i][j][k]);
+ assertTrue(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must be found in scan");
} else {
- assertFalse(
- "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan",
- foundKvs[i][j][k]);
+ assertFalse(foundKvs[i][j][k],
+ "(r, cf, cq) == (" + i + ", " + j + ", " + k + ") must not be found in scan");
}
}
}
@@ -387,7 +378,7 @@ public abstract class TestCfCqSlice {
int cf = LONG_LEX.decode(k.getColumnFamily().copyBytes()).intValue();
int cq = LONG_LEX.decode(k.getColumnQualifier().copyBytes()).intValue();
- assertFalse("Duplicate " + row + " " + cf + " " + cq, foundKvs[row][cf][cq]);
+ assertFalse(foundKvs[row][cf][cq], "Duplicate " + row + " " + cf + " " + cq);
foundKvs[row][cf][cq] = true;
if (random.nextInt(100) == 0) {
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 d68fc57..98c4057 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
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.iterators.user;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -54,8 +54,8 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.hadoop.io.Text;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class TransformingIteratorTest {
@@ -66,7 +66,7 @@ public class TransformingIteratorTest {
private TreeMap<Key,Value> data = new TreeMap<>();
- @Before
+ @BeforeEach
public void createData() {
data.clear();
generateRow(data, "row1");
@@ -452,13 +452,13 @@ public class TransformingIteratorTest {
Value actualValue = titer.getTopValue();
titer.next();
- assertNotNull("Ran out of expected entries on: " + actualKey, expected);
- assertEquals("Key mismatch", expected.getKey(), actualKey);
- assertEquals("Value mismatch", expected.getValue(), actualValue);
+ assertNotNull(expected, "Ran out of expected entries on: " + actualKey);
+ assertEquals(expected.getKey(), actualKey, "Key mismatch");
+ assertEquals(expected.getValue(), actualValue, "Value mismatch");
}
- assertTrue("Scanner did not return all expected entries: " + expectedEntries,
- expectedEntries.isEmpty());
+ assertTrue(expectedEntries.isEmpty(),
+ "Scanner did not return all expected entries: " + expectedEntries);
}
private static void putExpected(SortedMap<Key,Value> expected, int rowID, int cfID, int cqID,
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 e530e63..aab32b4 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
@@ -18,10 +18,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 static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.ArrayList;
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.LongCombiner;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,7 +57,7 @@ public class VersioningIteratorTest {
}
}
- assertEquals("Initial size was " + tm.size(), 40, tm.size());
+ assertEquals(40, tm.size(), "Initial size was " + tm.size());
}
TreeMap<Key,Value> iteratorOverTestData(VersioningIterator it) throws IOException {
@@ -92,7 +92,7 @@ public class VersioningIteratorTest {
assertEquals(8, e.getValue().get().length);
assertTrue(16 < encoder.decode(e.getValue().get()));
}
- assertEquals("size after keeping 3 versions was " + tmOut.size(), 6, tmOut.size());
+ assertEquals(6, tmOut.size(), "size after keeping 3 versions was " + tmOut.size());
} catch (IOException e) {
fail();
} catch (Exception e) {
@@ -128,7 +128,7 @@ public class VersioningIteratorTest {
assertEquals(8, e.getValue().get().length);
assertTrue(16 < encoder.decode(e.getValue().get()));
}
- assertEquals("size after keeping 2 versions was " + tmOut.size(), 2, tmOut.size());
+ assertEquals(2, tmOut.size(), "size after keeping 2 versions was " + tmOut.size());
} catch (IOException e) {
fail();
} catch (Exception e) {
@@ -163,7 +163,7 @@ public class VersioningIteratorTest {
assertTrue(16 < encoder.decode(e.getValue().get()));
}
- assertEquals("size after seeking past versions was " + tmOut.size(), 0, tmOut.size());
+ assertEquals(0, tmOut.size(), "size after seeking past versions was " + 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);
@@ -176,7 +176,7 @@ public class VersioningIteratorTest {
assertTrue(16 < encoder.decode(e.getValue().get()));
}
- assertEquals("size after seeking past versions was " + tmOut.size(), 3, tmOut.size());
+ assertEquals(3, tmOut.size(), "size after seeking past versions was " + tmOut.size());
} catch (IOException e) {
fail();
@@ -205,8 +205,8 @@ public class VersioningIteratorTest {
TreeMap<Key,Value> tmOut = iteratorOverTestData(it);
- assertEquals("size after keeping " + i + " versions was " + tmOut.size(), tmOut.size(),
- Math.min(40, 2 * i));
+ assertEquals(tmOut.size(), Math.min(40, 2 * i),
+ "size after keeping " + i + " versions was " + tmOut.size());
} catch (IOException e) {
fail();
} catch (Exception e) {
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/VisibilityFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/VisibilityFilterTest.java
index 211dfa5..d41e81c 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/VisibilityFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/VisibilityFilterTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.iterators.user;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.ArrayList;
@@ -37,7 +37,7 @@ import org.apache.accumulo.core.iterators.Filter;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class VisibilityFilterTest {
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 eb0541d..1fa69a2 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
@@ -34,9 +34,9 @@
*/
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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -53,7 +53,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iteratorsImpl.system.MultiIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class WholeColumnFamilyIteratorTest {
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 78c4533..720ffb4 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
@@ -18,10 +18,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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iteratorsImpl.system.MultiIterator;
import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class WholeRowIteratorTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
index 889d836..0a1c515 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.metadata;
-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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashMap;
@@ -31,8 +31,8 @@ import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.core.data.TableId;
import org.easymock.EasyMock;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class MetadataServicerTest {
@@ -47,7 +47,7 @@ public class MetadataServicerTest {
private static final String REPL_TABLE_NAME =
org.apache.accumulo.core.replication.ReplicationTable.NAME;
- @BeforeClass
+ @BeforeAll
public static void setupContext() {
HashMap<String,String> tableNameToIdMap = new HashMap<>();
tableNameToIdMap.put(RootTable.NAME, RootTable.ID.canonical());
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/DeleteMetadataTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/DeleteMetadataTest.java
index 3382c08..350ac9e 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/DeleteMetadataTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/DeleteMetadataTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.metadata.schema;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.DeletesSection;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DeleteMetadataTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/LinkingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/LinkingIteratorTest.java
index bb929f7..78e9955 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/LinkingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/LinkingIteratorTest.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.core.metadata.schema;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.create;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Arrays;
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Lists;
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/MetadataSchemaTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/MetadataSchemaTest.java
index f4c796f..6a95128 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/MetadataSchemaTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/MetadataSchemaTest.java
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.core.metadata.schema;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.TabletColumnFamily;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MetadataSchemaTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/MetadataTimeTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/MetadataTimeTest.java
index 5552d92..10f2547 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/MetadataTimeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/MetadataTimeTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.accumulo.core.metadata.schema;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.accumulo.core.client.admin.TimeType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MetadataTimeTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/SortSkewTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/SortSkewTest.java
index 48ccd09..4d3fe77 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/SortSkewTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/SortSkewTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.metadata.schema;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SortSkewTest {
private static final String shortpath = "1";
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletFileTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletFileTest.java
index 7826a9e..3b1a7b8 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletFileTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.accumulo.core.metadata.schema;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.metadata.StoredTabletFile;
import org.apache.accumulo.core.metadata.TabletFile;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TabletFileTest {
@@ -57,25 +57,30 @@ public class TabletFileTest {
// 2a< srv:dir
final String message = "Failed to throw error on bad path";
- assertThrows(message, NullPointerException.class,
- () -> test("C0004.rf", "", "2a", "t-0003", "C0004.rf"));
- assertThrows(message, NullPointerException.class, () -> test("dir", "", "2a", "", ""));
+ assertThrows(NullPointerException.class, () -> test("C0004.rf", "", "2a", "t-0003", "C0004.rf"),
+ message);
+ assertThrows(NullPointerException.class, () -> test("dir", "", "2a", "", ""), message);
- assertThrows(message, IllegalArgumentException.class,
+ assertThrows(IllegalArgumentException.class,
() -> test("hdfs://localhost:8020/accumulo/tablets/2a/default_tablet/F0000070.rf",
- "hdfs://localhost:8020/accumulo", "2a", "default_tablet", "F0000070.rf"));
- assertThrows(message, IllegalArgumentException.class,
+ "hdfs://localhost:8020/accumulo", "2a", "default_tablet", "F0000070.rf"),
+ message);
+ assertThrows(IllegalArgumentException.class,
() -> test("hdfs://localhost:8020/accumulo/2a/default_tablet/F0000070.rf",
- " hdfs://localhost:8020/accumulo", "2a", "default_tablet", " F0000070.rf"));
- assertThrows(message, IllegalArgumentException.class,
+ " hdfs://localhost:8020/accumulo", "2a", "default_tablet", " F0000070.rf"),
+ message);
+ assertThrows(IllegalArgumentException.class,
() -> test("/accumulo/tables/2a/default_tablet/F0000070.rf", "", "2a", "default_tablet",
- "F0000070.rf"));
- assertThrows(message, IllegalArgumentException.class,
+ "F0000070.rf"),
+ message);
+ assertThrows(IllegalArgumentException.class,
() -> test("hdfs://localhost:8020/accumulo/tables/2a/F0000070.rf",
- "hdfs://localhost:8020/accumulo", "2a", "", "F0000070.rf"));
- assertThrows(message, IllegalArgumentException.class,
+ "hdfs://localhost:8020/accumulo", "2a", "", "F0000070.rf"),
+ message);
+ assertThrows(IllegalArgumentException.class,
() -> test("hdfs://localhost:8020/accumulo/tables/F0000070.rf",
- "hdfs://localhost:8020/accumulo", null, "", "F0000070.rf"));
+ "hdfs://localhost:8020/accumulo", null, "", "F0000070.rf"),
+ message);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java
index b72cf90..ea9e69a 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java
@@ -27,11 +27,11 @@ import static org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSec
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LAST;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LOCATION;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.SUSPEND;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.EnumSet;
import java.util.LinkedHashSet;
@@ -63,7 +63,7 @@ import org.apache.accumulo.core.tabletserver.log.LogEntry;
import org.apache.accumulo.core.util.HostAndPort;
import org.apache.accumulo.fate.FateTxId;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TabletMetadataTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java
index ff49857..5e92dd0 100644
--- a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.replication;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashMap;
import java.util.Map;
@@ -32,15 +32,15 @@ import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
@Deprecated
public class ReplicationConfigurationUtilTest {
private AccumuloConfiguration conf;
- @Before
+ @BeforeEach
public void setupConfiguration() {
Map<String,String> map = new HashMap<>();
map.put(Property.TABLE_REPLICATION.getKey(), "true");
@@ -50,41 +50,44 @@ public class ReplicationConfigurationUtilTest {
@Test
public void rootTableExtent() {
KeyExtent extent = new KeyExtent(RootTable.ID, null, null);
- assertFalse("The root table should never be replicated",
- ReplicationConfigurationUtil.isEnabled(extent, conf));
+ assertFalse(ReplicationConfigurationUtil.isEnabled(extent, conf),
+ "The root table should never be replicated");
}
@Test
public void metadataTableExtent() {
KeyExtent extent = new KeyExtent(MetadataTable.ID, null, null);
- assertFalse("The metadata table should never be replicated",
- ReplicationConfigurationUtil.isEnabled(extent, conf));
+ assertFalse(ReplicationConfigurationUtil.isEnabled(extent, conf),
+ "The metadata table should never be replicated");
}
@Test
public void rootTableExtentEmptyConf() {
KeyExtent extent = new KeyExtent(RootTable.ID, null, null);
- assertFalse("The root table should never be replicated",
- ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
+ assertFalse(
+ ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())),
+ "The root table should never be replicated");
}
@Test
public void metadataTableExtentEmptyConf() {
KeyExtent extent = new KeyExtent(MetadataTable.ID, null, null);
- assertFalse("The metadata table should never be replicated",
- ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
+ assertFalse(
+ ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())),
+ "The metadata table should never be replicated");
}
@Test
public void regularTable() {
KeyExtent extent = new KeyExtent(TableId.of("1"), new Text("b"), new Text("a"));
- assertTrue("Table should be replicated", ReplicationConfigurationUtil.isEnabled(extent, conf));
+ assertTrue(ReplicationConfigurationUtil.isEnabled(extent, conf), "Table should be replicated");
}
@Test
public void regularNonEnabledTable() {
KeyExtent extent = new KeyExtent(TableId.of("1"), new Text("b"), new Text("a"));
- assertFalse("Table should not be replicated",
- ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
+ assertFalse(
+ ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())),
+ "Table should not be replicated");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationSchemaTest.java b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationSchemaTest.java
index 3670bbc..d379fa1 100644
--- a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationSchemaTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationSchemaTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.replication;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
@@ -28,7 +28,7 @@ import org.apache.accumulo.core.replication.ReplicationSchema.OrderSection;
import org.apache.accumulo.core.replication.ReplicationSchema.StatusSection;
import org.apache.accumulo.core.replication.ReplicationSchema.WorkSection;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated
public class ReplicationSchemaTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationTargetTest.java b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationTargetTest.java
index 42a39ee..7dd0237 100644
--- a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationTargetTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationTargetTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.replication;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import org.apache.accumulo.core.data.TableId;
import org.apache.hadoop.io.DataInputBuffer;
import org.apache.hadoop.io.DataOutputBuffer;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@Deprecated
public class ReplicationTargetTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/rpc/SaslClientDigestCallbackHandlerTest.java b/core/src/test/java/org/apache/accumulo/core/rpc/SaslClientDigestCallbackHandlerTest.java
index 83d10db..5229cbc 100644
--- a/core/src/test/java/org/apache/accumulo/core/rpc/SaslClientDigestCallbackHandlerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/rpc/SaslClientDigestCallbackHandlerTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.rpc;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SaslClientDigestCallbackHandlerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/rpc/SaslConnectionParamsTest.java b/core/src/test/java/org/apache/accumulo/core/rpc/SaslConnectionParamsTest.java
index f56fc66..916a897 100644
--- a/core/src/test/java/org/apache/accumulo/core/rpc/SaslConnectionParamsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/rpc/SaslConnectionParamsTest.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.core.rpc;
import static org.apache.accumulo.core.clientImpl.AuthenticationTokenIdentifier.createTAuthIdentifier;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.security.PrivilegedExceptionAction;
import java.util.Map;
@@ -41,8 +41,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.security.UserGroupInformation;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class SaslConnectionParamsTest {
@@ -50,7 +50,7 @@ public class SaslConnectionParamsTest {
private String username;
private static final String primary = "accumulo";
- @Before
+ @BeforeEach
public void setup() {
System.setProperty("java.security.krb5.realm", "accumulo");
System.setProperty("java.security.krb5.kdc", "fake");
diff --git a/core/src/test/java/org/apache/accumulo/core/rpc/TTimeoutTransportTest.java b/core/src/test/java/org/apache/accumulo/core/rpc/TTimeoutTransportTest.java
index ad7fac5..0393d81 100644
--- a/core/src/test/java/org/apache/accumulo/core/rpc/TTimeoutTransportTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/rpc/TTimeoutTransportTest.java
@@ -24,7 +24,7 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.io.InputStream;
@@ -32,7 +32,7 @@ import java.net.Socket;
import java.net.SocketAddress;
import org.apache.thrift.transport.TTransportException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for {@link TTimeoutTransport}.
diff --git a/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifierTest.java b/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifierTest.java
index 0f950ae..5c4f4b7 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifierTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifierTest.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.core.security;
import static org.apache.accumulo.core.clientImpl.AuthenticationTokenIdentifier.createTAuthIdentifier;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -33,7 +33,7 @@ import org.apache.accumulo.core.clientImpl.AuthenticationTokenIdentifier;
import org.apache.accumulo.core.data.InstanceId;
import org.apache.accumulo.core.securityImpl.thrift.TAuthenticationTokenIdentifier;
import org.apache.hadoop.security.UserGroupInformation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AuthenticationTokenIdentifierTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenTest.java b/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenTest.java
index 50631ca..5154f11 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.security;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.security.SecureRandom;
import java.util.stream.IntStream;
@@ -28,7 +28,7 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer;
import org.apache.accumulo.core.client.security.tokens.NullToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AuthenticationTokenTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java b/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java
index d0fa476..8705b8a 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java
@@ -18,15 +18,15 @@
*/
package org.apache.accumulo.core.security;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.ByteBuffer;
import org.apache.accumulo.core.util.ByteArraySet;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AuthorizationsTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/security/ColumnVisibilityTest.java b/core/src/test/java/org/apache/accumulo/core/security/ColumnVisibilityTest.java
index 6a8140f..6b0defa 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/ColumnVisibilityTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/ColumnVisibilityTest.java
@@ -20,10 +20,10 @@ package org.apache.accumulo.core.security;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.accumulo.core.security.ColumnVisibility.quote;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Comparator;
@@ -31,15 +31,15 @@ import org.apache.accumulo.core.security.ColumnVisibility.Node;
import org.apache.accumulo.core.security.ColumnVisibility.NodeComparator;
import org.apache.accumulo.core.security.ColumnVisibility.NodeType;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ColumnVisibilityTest {
private void shouldThrow(String... strings) {
for (String s : strings) {
final byte[] sBytes = s.getBytes();
- assertThrows("Should throw: " + s, IllegalArgumentException.class,
- () -> new ColumnVisibility(sBytes));
+ assertThrows(IllegalArgumentException.class, () -> new ColumnVisibility(sBytes),
+ "Should throw: " + s);
}
}
@@ -234,8 +234,8 @@ public class ColumnVisibilityTest {
// Convert to String for indexOf convenience
String flat = new String(flattened, UTF_8);
- assertTrue("shortest expressions sort first", flat.indexOf('e') < flat.indexOf('|'));
- assertTrue("shortest children sort first", flat.indexOf('b') < flat.indexOf('a'));
+ assertTrue(flat.indexOf('e') < flat.indexOf('|'), "shortest expressions sort first");
+ assertTrue(flat.indexOf('b') < flat.indexOf('a'), "shortest children sort first");
}
private Node parse(String s) {
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 0837599..8635c8c 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
@@ -19,14 +19,16 @@
package org.apache.accumulo.core.security;
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.assertNotEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import javax.security.auth.DestroyFailedException;
+import org.apache.accumulo.core.WithTestNames;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.security.SecurityErrorCode;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer;
@@ -35,20 +37,13 @@ import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.clientImpl.Credentials;
import org.apache.accumulo.core.data.InstanceId;
import org.apache.accumulo.core.securityImpl.thrift.TCredentials;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
-public class CredentialsTest {
-
- @Rule
- public TestName test = new TestName();
-
- private InstanceId instanceID;
+public class CredentialsTest extends WithTestNames {
@Test
public void testToThrift() throws DestroyFailedException {
- instanceID = InstanceId.of(test.getMethodName());
+ var instanceID = InstanceId.of(testName());
// verify thrift serialization
Credentials creds = new Credentials("test", new PasswordToken("testing"));
TCredentials tCreds = creds.toThrift(instanceID);
@@ -60,23 +55,22 @@ public class CredentialsTest {
// verify that we can't serialize if it's destroyed
creds.getToken().destroy();
Exception e = assertThrows(RuntimeException.class, () -> creds.toThrift(instanceID));
- assertEquals(AccumuloSecurityException.class, e.getCause().getClass());
+ assertSame(AccumuloSecurityException.class, e.getCause().getClass());
assertEquals(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode(),
SecurityErrorCode.TOKEN_EXPIRED);
}
@Test
public void roundtripThrift() {
- instanceID = InstanceId.of(test.getMethodName());
+ var instanceID = InstanceId.of(testName());
Credentials creds = new Credentials("test", new PasswordToken("testing"));
TCredentials tCreds = creds.toThrift(instanceID);
Credentials roundtrip = Credentials.fromThrift(tCreds);
- assertEquals("Roundtrip through thirft changed credentials equality", creds, roundtrip);
+ assertEquals(creds, roundtrip, "Round-trip through thrift changed credentials equality");
}
@Test
public void testEqualsAndHashCode() {
- instanceID = InstanceId.of(test.getMethodName());
Credentials nullNullCreds = new Credentials(null, null);
Credentials abcNullCreds = new Credentials("abc", new NullToken());
Credentials cbaNullCreds = new Credentials("cba", new NullToken());
@@ -102,7 +96,6 @@ public class CredentialsTest {
@Test
public void testCredentialsSerialization() {
- instanceID = InstanceId.of(test.getMethodName());
Credentials creds = new Credentials("a:b-c", new PasswordToken("d-e-f".getBytes(UTF_8)));
String serialized = creds.serialize();
Credentials result = Credentials.deserialize(serialized);
@@ -119,7 +112,6 @@ public class CredentialsTest {
@Test
public void testToString() {
- instanceID = InstanceId.of(test.getMethodName());
Credentials creds = new Credentials(null, null);
assertEquals(Credentials.class.getName() + ":null:null:<hidden>", creds.toString());
creds = new Credentials("", new NullToken());
diff --git a/core/src/test/java/org/apache/accumulo/core/security/NamespacePermissionsTest.java b/core/src/test/java/org/apache/accumulo/core/security/NamespacePermissionsTest.java
index 4faa3be..1edf8e8 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/NamespacePermissionsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/NamespacePermissionsTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.security;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.EnumSet;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class NamespacePermissionsTest {
@Test
@@ -36,7 +36,7 @@ public class NamespacePermissionsTest {
set.remove(NamespacePermission.getEquivalent(permission));
}
- assertTrue("All namespace permissions should have equivalent table or system permissions.",
- set.isEmpty());
+ assertTrue(set.isEmpty(),
+ "All namespace permissions should have equivalent table or system permissions.");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/security/VisibilityEvaluatorTest.java b/core/src/test/java/org/apache/accumulo/core/security/VisibilityEvaluatorTest.java
index 8e2bd3e..f1c6c68 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/VisibilityEvaluatorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/VisibilityEvaluatorTest.java
@@ -19,16 +19,16 @@
package org.apache.accumulo.core.security;
import static org.apache.accumulo.core.security.ColumnVisibility.quote;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.util.ByteArraySet;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class VisibilityEvaluatorTest {
@@ -41,24 +41,24 @@ public class VisibilityEvaluatorTest {
assertTrue(ct.evaluate(new ColumnVisibility(new byte[0])));
// test for and
- assertTrue("'and' test", ct.evaluate(new ColumnVisibility("one&two")));
+ assertTrue(ct.evaluate(new ColumnVisibility("one&two")), "'and' test");
// test for or
- assertTrue("'or' test", ct.evaluate(new ColumnVisibility("foor|four")));
+ assertTrue(ct.evaluate(new ColumnVisibility("foor|four")), "'or' test");
// test for and and or
- assertTrue("'and' and 'or' test", ct.evaluate(new ColumnVisibility("(one&two)|(foo&bar)")));
+ assertTrue(ct.evaluate(new ColumnVisibility("(one&two)|(foo&bar)")), "'and' and 'or' test");
// test for false negatives
for (String marking : new String[] {"one", "one|five", "five|one", "(one)",
"(one&two)|(foo&bar)", "(one|foo)&three", "one|foo|bar", "(one|foo)|bar",
"((one|foo)|bar)&two"}) {
- assertTrue(marking, ct.evaluate(new ColumnVisibility(marking)));
+ assertTrue(ct.evaluate(new ColumnVisibility(marking)), marking);
}
// test for false positives
for (String marking : new String[] {"five", "one&five", "five&one", "((one|foo)|bar)&goober"}) {
- assertFalse(marking, ct.evaluate(new ColumnVisibility(marking)));
+ assertFalse(ct.evaluate(new ColumnVisibility(marking)), marking);
}
}
@@ -115,8 +115,8 @@ public class VisibilityEvaluatorTest {
final var invalidEscapeSeqList = List.of(new ArrayByteSequence("a\\b"),
new ArrayByteSequence("a\\b\\c"), new ArrayByteSequence("a\"b\\"));
- invalidEscapeSeqList.forEach(seq -> assertThrows(message, IllegalArgumentException.class,
- () -> VisibilityEvaluator.unescape(seq)));
+ invalidEscapeSeqList.forEach(seq -> assertThrows(IllegalArgumentException.class,
+ () -> VisibilityEvaluator.unescape(seq), message));
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/singletons/SingletonManagerTest.java b/core/src/test/java/org/apache/accumulo/core/singletons/SingletonManagerTest.java
index 003116c..0d9be6b 100644
--- a/core/src/test/java/org/apache/accumulo/core/singletons/SingletonManagerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/singletons/SingletonManagerTest.java
@@ -18,21 +18,21 @@
*/
package org.apache.accumulo.core.singletons;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.accumulo.core.singletons.SingletonManager.Mode;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class SingletonManagerTest {
TestService service1;
TestService service2;
- @Before
+ @BeforeEach
public void setup() {
SingletonManager.reset();
assertEquals(0, SingletonManager.getReservationCount());
@@ -121,8 +121,8 @@ public class SingletonManagerTest {
assertEquals(new TestService(false, 0, 1), service1);
assertEquals(new TestService(false, 1, 1), service2);
- assertThrows("Should only be able to set mode to CONNECTOR once", IllegalStateException.class,
- () -> SingletonManager.setMode(Mode.CONNECTOR));
+ assertThrows(IllegalStateException.class, () -> SingletonManager.setMode(Mode.CONNECTOR),
+ "Should only be able to set mode to CONNECTOR once");
assertEquals(Mode.CLIENT, SingletonManager.getMode());
}
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/balancer/GroupBalancerTest.java b/core/src/test/java/org/apache/accumulo/core/spi/balancer/GroupBalancerTest.java
index e321dfe..d592cc5 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/balancer/GroupBalancerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/balancer/GroupBalancerTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.spi.balancer;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.security.SecureRandom;
import java.util.ArrayList;
@@ -45,7 +45,7 @@ import org.apache.accumulo.core.spi.balancer.data.TabletMigration;
import org.apache.accumulo.core.spi.balancer.data.TabletServerId;
import org.apache.accumulo.core.util.MapCounter;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class GroupBalancerTest {
@@ -123,8 +123,8 @@ public class GroupBalancerTest {
balancer.balance(new BalanceParamsImpl(current, migrations, migrationsOut));
- assertTrue("Max Migration exceeded " + maxMigrations + " " + migrationsOut.size(),
- migrationsOut.size() <= (maxMigrations + 5));
+ assertTrue(migrationsOut.size() <= (maxMigrations + 5),
+ "Max Migration exceeded " + maxMigrations + " " + migrationsOut.size());
for (TabletMigration tabletMigration : migrationsOut) {
assertEquals(tabletLocs.get(tabletMigration.getTablet()),
@@ -178,10 +178,9 @@ public class GroupBalancerTest {
int tserverExtra = 0;
for (String group : groupCounts.keySet()) {
assertTrue(tgc.get(group) >= expectedCounts.get(group));
- assertTrue(
+ assertTrue(tgc.get(group) <= expectedCounts.get(group) + 1,
"Group counts not as expected group:" + group + " actual:" + tgc.get(group)
- + " expected:" + (expectedCounts.get(group) + 1) + " tserver:" + entry.getKey(),
- tgc.get(group) <= expectedCounts.get(group) + 1);
+ + " expected:" + (expectedCounts.get(group) + 1) + " tserver:" + entry.getKey());
tserverExtra += tgc.get(group) - expectedCounts.get(group);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancerReconfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancerReconfigurationTest.java
index 6440fa3..3878a41 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancerReconfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancerReconfigurationTest.java
@@ -22,9 +22,9 @@ import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Collections;
@@ -49,7 +49,7 @@ import org.apache.accumulo.core.spi.balancer.data.TabletStatistics;
import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
import org.apache.accumulo.core.util.ConfigurationImpl;
import org.apache.accumulo.fate.util.UtilWaitThread;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class HostRegexTableLoadBalancerReconfigurationTest
extends BaseHostRegexTableLoadBalancerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancerTest.java b/core/src/test/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancerTest.java
index 33fb741..9a96af1 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancerTest.java
@@ -23,10 +23,10 @@ import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
-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 static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Collections;
@@ -55,7 +55,7 @@ import org.apache.accumulo.core.spi.balancer.data.TabletStatistics;
import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
import org.apache.accumulo.core.util.ConfigurationImpl;
import org.apache.accumulo.fate.util.UtilWaitThread;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class HostRegexTableLoadBalancerTest extends BaseHostRegexTableLoadBalancerTest {
@@ -79,9 +79,9 @@ public class HostRegexTableLoadBalancerTest extends BaseHostRegexTableLoadBalanc
@Test
public void testInit() {
init(DEFAULT_TABLE_PROPERTIES);
- assertEquals("OOB check interval value is incorrect", 7000, this.getOobCheckMillis());
- assertEquals("Max migrations is incorrect", 4, this.getMaxMigrations());
- assertEquals("Max outstanding migrations is incorrect", 10, this.getMaxOutstandingMigrations());
+ assertEquals(7000, this.getOobCheckMillis(), "OOB check interval value is incorrect");
+ assertEquals(4, this.getMaxMigrations(), "Max migrations is incorrect");
+ assertEquals(10, this.getMaxOutstandingMigrations(), "Max outstanding migrations is incorrect");
assertFalse(isIpBasedRegex());
Map<String,Pattern> patterns = this.getPoolNameToRegexPattern();
assertEquals(2, patterns.size());
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancerTest.java b/core/src/test/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancerTest.java
index 663d315..1f50dd2 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancerTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.spi.balancer;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Collections;
@@ -48,8 +48,8 @@ import org.apache.accumulo.core.spi.balancer.data.TabletServerId;
import org.apache.accumulo.core.spi.balancer.data.TabletStatistics;
import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class SimpleLoadBalancerTest {
@@ -94,7 +94,7 @@ public class SimpleLoadBalancerTest {
}
}
- @Before
+ @BeforeEach
public void setUp() {
last.clear();
servers.clear();
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/balancer/TableLoadBalancerTest.java b/core/src/test/java/org/apache/accumulo/core/spi/balancer/TableLoadBalancerTest.java
index 47786cc..bed489f 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/balancer/TableLoadBalancerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/balancer/TableLoadBalancerTest.java
@@ -22,7 +22,7 @@ import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collections;
@@ -51,7 +51,7 @@ import org.apache.accumulo.core.spi.balancer.data.TabletStatistics;
import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
import org.apache.accumulo.core.util.ConfigurationImpl;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TableLoadBalancerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/compaction/DefaultCompactionPlannerTest.java b/core/src/test/java/org/apache/accumulo/core/spi/compaction/DefaultCompactionPlannerTest.java
index 0900237..5a50827 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/compaction/DefaultCompactionPlannerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/compaction/DefaultCompactionPlannerTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.spi.compaction;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.net.URI;
import java.net.URISyntaxException;
@@ -42,7 +42,7 @@ import org.apache.accumulo.core.util.compaction.CompactionExecutorIdImpl;
import org.apache.accumulo.core.util.compaction.CompactionPlanImpl;
import org.apache.hadoop.shaded.com.google.common.collect.Iterables;
import org.easymock.EasyMock;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DefaultCompactionPlannerTest {
@@ -251,9 +251,9 @@ public class DefaultCompactionPlannerTest {
String executors = getExecutors("'type': 'internal','maxSize':'32M'",
"'type': 'internal','maxSize':'128M','numThreads':2",
"'type': 'internal','maxSize':'512M','numThreads':3");
- var e = assertThrows("Failed to throw error", NullPointerException.class,
- () -> planner.init(getInitParams(senv, executors)));
- assertTrue("Error message didn't contain numThreads", e.getMessage().contains("numThreads"));
+ var e = assertThrows(NullPointerException.class,
+ () -> planner.init(getInitParams(senv, executors)), "Failed to throw error");
+ assertTrue(e.getMessage().contains("numThreads"), "Error message didn't contain numThreads");
}
/**
@@ -272,9 +272,9 @@ public class DefaultCompactionPlannerTest {
String executors = getExecutors("'type': 'internal','maxSize':'32M','numThreads':1",
"'type': 'internal','maxSize':'128M','numThreads':2",
"'type': 'external','maxSize':'512M','numThreads':3");
- var e = assertThrows("Failed to throw error", IllegalArgumentException.class,
- () -> planner.init(getInitParams(senv, executors)));
- assertTrue("Error message didn't contain numThreads", e.getMessage().contains("numThreads"));
+ var e = assertThrows(IllegalArgumentException.class,
+ () -> planner.init(getInitParams(senv, executors)), "Failed to throw error");
+ assertTrue(e.getMessage().contains("numThreads"), "Error message didn't contain numThreads");
}
/**
@@ -293,9 +293,9 @@ public class DefaultCompactionPlannerTest {
String executors = getExecutors("'type': 'internal','maxSize':'32M','numThreads':1",
"'type': 'internal','maxSize':'128M','numThreads':2",
"'type': 'external','maxSize':'512M'");
- var e = assertThrows("Failed to throw error", NullPointerException.class,
- () -> planner.init(getInitParams(senv, executors)));
- assertTrue("Error message didn't contain queue", e.getMessage().contains("queue"));
+ var e = assertThrows(NullPointerException.class,
+ () -> planner.init(getInitParams(senv, executors)), "Failed to throw error");
+ assertTrue(e.getMessage().contains("queue"), "Error message didn't contain queue");
}
/**
@@ -313,9 +313,9 @@ public class DefaultCompactionPlannerTest {
String executors = getExecutors("'type': 'internal','maxSize':'32M','numThreads':1",
"'type': 'internal','numThreads':2", "'type': 'external','queue':'q1'");
- var e = assertThrows("Failed to throw error", IllegalArgumentException.class,
- () -> planner.init(getInitParams(senv, executors)));
- assertTrue("Error message didn't contain maxSize", e.getMessage().contains("maxSize"));
+ var e = assertThrows(IllegalArgumentException.class,
+ () -> planner.init(getInitParams(senv, executors)), "Failed to throw error");
+ assertTrue(e.getMessage().contains("maxSize"), "Error message didn't contain maxSize");
}
/**
@@ -334,9 +334,9 @@ public class DefaultCompactionPlannerTest {
String executors = getExecutors("'type': 'internal','maxSize':'32M','numThreads':1",
"'type': 'internal','maxSize':'128M','numThreads':2",
"'type': 'external','maxSize':'128M','queue':'q1'");
- var e = assertThrows("Failed to throw error", IllegalArgumentException.class,
- () -> planner.init(getInitParams(senv, executors)));
- assertTrue("Error message didn't contain maxSize", e.getMessage().contains("maxSize"));
+ var e = assertThrows(IllegalArgumentException.class,
+ () -> planner.init(getInitParams(senv, executors)), "Failed to throw error");
+ assertTrue(e.getMessage().contains("maxSize"), "Error message didn't contain maxSize");
}
private CompactionPlanner.InitParameters getInitParams(ServiceEnvironment senv,
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooserTest.java b/core/src/test/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooserTest.java
index 3ab3ccf..955bb01 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooserTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/fs/PerTableVolumeChooserTest.java
@@ -23,8 +23,8 @@ import static org.easymock.EasyMock.createStrictMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Optional;
@@ -33,9 +33,9 @@ import org.apache.accumulo.core.spi.common.ServiceEnvironment;
import org.apache.accumulo.core.spi.common.ServiceEnvironment.Configuration;
import org.apache.accumulo.core.spi.fs.VolumeChooserEnvironment.Scope;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class PerTableVolumeChooserTest {
@@ -54,7 +54,7 @@ public class PerTableVolumeChooserTest {
public static class MockChooser2 extends RandomVolumeChooser {}
- @Before
+ @BeforeEach
public void before() {
serviceEnv = createStrictMock(ServiceEnvironment.class);
@@ -66,7 +66,7 @@ public class PerTableVolumeChooserTest {
expect(serviceEnv.getConfiguration()).andReturn(systemConf).anyTimes();
}
- @After
+ @AfterEach
public void after() {
verify(serviceEnv, tableConf, systemConf);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/fs/PreferredVolumeChooserTest.java b/core/src/test/java/org/apache/accumulo/core/spi/fs/PreferredVolumeChooserTest.java
index f67fb6a..7cb2e3b 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/fs/PreferredVolumeChooserTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/fs/PreferredVolumeChooserTest.java
@@ -23,8 +23,8 @@ import static org.easymock.EasyMock.createStrictMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Optional;
import java.util.Set;
@@ -34,9 +34,9 @@ import org.apache.accumulo.core.spi.common.ServiceEnvironment;
import org.apache.accumulo.core.spi.common.ServiceEnvironment.Configuration;
import org.apache.accumulo.core.spi.fs.VolumeChooserEnvironment.Scope;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class PreferredVolumeChooserTest {
@@ -53,7 +53,7 @@ public class PreferredVolumeChooserTest {
private Configuration systemConf;
private PreferredVolumeChooser chooser;
- @Before
+ @BeforeEach
public void before() {
serviceEnv = createStrictMock(ServiceEnvironment.class);
@@ -65,7 +65,7 @@ public class PreferredVolumeChooserTest {
expect(serviceEnv.getConfiguration()).andReturn(systemConf).anyTimes();
}
- @After
+ @AfterEach
public void after() {
verify(serviceEnv, tableConf, systemConf);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/fs/SpaceAwareVolumeChooserTest.java b/core/src/test/java/org/apache/accumulo/core/spi/fs/SpaceAwareVolumeChooserTest.java
index 37ea79b..1269d13 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/fs/SpaceAwareVolumeChooserTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/fs/SpaceAwareVolumeChooserTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.spi.fs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.util.Set;
@@ -28,9 +28,9 @@ import org.apache.accumulo.core.spi.common.ServiceEnvironment;
import org.apache.accumulo.core.spi.common.ServiceEnvironment.Configuration;
import org.apache.accumulo.core.spi.fs.VolumeChooserEnvironment.Scope;
import org.easymock.EasyMock;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.util.concurrent.UncheckedExecutionException;
@@ -54,7 +54,7 @@ public class SpaceAwareVolumeChooserTest {
int vol1Count = 0;
int vol2Count = 0;
- @Before
+ @BeforeEach
public void beforeTest() {
serviceEnv = EasyMock.createMock(ServiceEnvironment.class);
sysConfig = EasyMock.createMock(Configuration.class);
@@ -88,7 +88,7 @@ public class SpaceAwareVolumeChooserTest {
EasyMock.replay(serviceEnv, sysConfig, chooserEnv);
}
- @After
+ @AfterEach
public void afterTest() {
EasyMock.verify(serviceEnv, sysConfig, chooserEnv);
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/scan/HintScanPrioritizerTest.java b/core/src/test/java/org/apache/accumulo/core/spi/scan/HintScanPrioritizerTest.java
index 05bb6b6..a2cbb27 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/scan/HintScanPrioritizerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/scan/HintScanPrioritizerTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.spi.scan;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collections;
@@ -28,7 +28,7 @@ import java.util.Map;
import org.apache.accumulo.core.spi.common.ServiceEnvironment;
import org.apache.accumulo.core.spi.scan.ScanInfo.Type;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class HintScanPrioritizerTest {
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/scan/IdleRatioScanPrioritizerTest.java b/core/src/test/java/org/apache/accumulo/core/spi/scan/IdleRatioScanPrioritizerTest.java
index 9047839..c48891c 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/scan/IdleRatioScanPrioritizerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/scan/IdleRatioScanPrioritizerTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.spi.scan;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collections;
@@ -28,7 +28,7 @@ import java.util.Map;
import org.apache.accumulo.core.spi.common.ServiceEnvironment;
import org.apache.accumulo.core.spi.scan.ScanInfo.Type;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class IdleRatioScanPrioritizerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/spi/scan/SimpleScanDispatcherTest.java b/core/src/test/java/org/apache/accumulo/core/spi/scan/SimpleScanDispatcherTest.java
index 7b3b5ff..f1c41d2 100644
--- a/core/src/test/java/org/apache/accumulo/core/spi/scan/SimpleScanDispatcherTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/spi/scan/SimpleScanDispatcherTest.java
@@ -22,8 +22,8 @@ import static org.apache.accumulo.core.spi.scan.ScanDispatch.CacheUsage.DISABLED
import static org.apache.accumulo.core.spi.scan.ScanDispatch.CacheUsage.ENABLED;
import static org.apache.accumulo.core.spi.scan.ScanDispatch.CacheUsage.OPPORTUNISTIC;
import static org.apache.accumulo.core.spi.scan.ScanDispatch.CacheUsage.TABLE;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collections;
import java.util.HashMap;
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.spi.common.ServiceEnvironment;
import org.apache.accumulo.core.spi.scan.ScanDispatch.CacheUsage;
import org.apache.accumulo.core.spi.scan.ScanDispatcher.DispatchParameters;
import org.apache.accumulo.core.spi.scan.ScanInfo.Type;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SimpleScanDispatcherTest {
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/summary/SummaryCollectionTest.java b/core/src/test/java/org/apache/accumulo/core/summary/SummaryCollectionTest.java
index 2a1539b..bcd803c 100644
--- a/core/src/test/java/org/apache/accumulo/core/summary/SummaryCollectionTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/summary/SummaryCollectionTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.summary;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.Collections;
@@ -30,7 +30,7 @@ import org.apache.accumulo.core.client.summary.Summary;
import org.apache.accumulo.core.client.summary.Summary.FileStatistics;
import org.apache.accumulo.core.client.summary.summarizers.FamilySummarizer;
import org.apache.accumulo.core.summary.SummaryCollection.FileSummary;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SummaryCollectionTest {
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/tabletserver/log/LogEntryTest.java b/core/src/test/java/org/apache/accumulo/core/tabletserver/log/LogEntryTest.java
index 05801ef..b66259f 100644
--- a/core/src/test/java/org/apache/accumulo/core/tabletserver/log/LogEntryTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/tabletserver/log/LogEntryTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.tabletserver.log;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
import java.io.IOException;
import java.util.Arrays;
@@ -31,7 +31,7 @@ import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class LogEntryTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/AddressUtilTest.java b/core/src/test/java/org/apache/accumulo/core/util/AddressUtilTest.java
index bc3d4d6..33d5204 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/AddressUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/AddressUtilTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.fail;
import java.security.Security;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,7 +75,7 @@ public class AddressUtilTest {
fail("The JVM Security settings cache DNS failures forever. "
+ "In this case we expect an exception but didn't get one.");
}
- assertEquals("Didn't get the ttl we expected", expectedTtl, result);
+ assertEquals(expectedTtl, result, "Didn't get the ttl we expected");
} catch (IllegalArgumentException exception) {
if (!expectException) {
log.error("Got an exception when we weren't expecting.", exception);
@@ -98,9 +98,8 @@ public class AddressUtilTest {
log.info("AddressUtil is (hopefully) going to spit out an error about DNS lookups. "
+ "you can ignore it.");
- assertThrows(
- "The JVM Security settings cache DNS failures forever, this should cause an exception.",
- IllegalArgumentException.class, () -> AddressUtil.getAddressCacheNegativeTtl(null));
+ assertThrows(IllegalArgumentException.class, () -> AddressUtil.getAddressCacheNegativeTtl(null),
+ "The JVM Security settings cache DNS failures forever, this should cause an exception.");
}
}
diff --git a/core/src/test/java/org/apache/accumulo/core/util/ByteBufferUtilTest.java b/core/src/test/java/org/apache/accumulo/core/util/ByteBufferUtilTest.java
index 2ad6755..73875db 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/ByteBufferUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/ByteBufferUtilTest.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.core.util;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -31,7 +31,7 @@ import java.util.List;
import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ByteBufferUtilTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/CompletableFutureUtilTest.java b/core/src/test/java/org/apache/accumulo/core/util/CompletableFutureUtilTest.java
index e2f9f02..3c7eeb6 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/CompletableFutureUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/CompletableFutureUtilTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collections;
@@ -27,7 +27,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CompletableFutureUtilTest {
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/util/FastFormatTest.java b/core/src/test/java/org/apache/accumulo/core/util/FastFormatTest.java
index f6440b6..6326a9d 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/FastFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/FastFormatTest.java
@@ -19,12 +19,12 @@
package org.apache.accumulo.core.util;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FastFormatTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/InternerTest.java b/core/src/test/java/org/apache/accumulo/core/util/InternerTest.java
index cebeda2..7e2d759 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/InternerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/InternerTest.java
@@ -18,12 +18,13 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
public class InternerTest {
@@ -79,7 +80,8 @@ public class InternerTest {
assertNotEquals(obj1, intern2);
}
- @Test(timeout = 20_000)
+ @Test
+ @Timeout(20_000)
public void testInternsGetGarbageCollected() {
var interner = new Interner<TestObj>();
assertEquals(0, interner.size()); // ensure empty
diff --git a/core/src/test/java/org/apache/accumulo/core/util/LocalityGroupUtilTest.java b/core/src/test/java/org/apache/accumulo/core/util/LocalityGroupUtilTest.java
index faff44a..c85e735 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/LocalityGroupUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/LocalityGroupUtilTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.HashSet;
import java.util.Map;
@@ -33,7 +33,7 @@ import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class LocalityGroupUtilTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/MergeTest.java b/core/src/test/java/org/apache/accumulo/core/util/MergeTest.java
index 2af1619..2e6daa5 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/MergeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/MergeTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Iterator;
@@ -30,7 +30,7 @@ import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.util.Merge.Size;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MergeTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/MonitorUtilTest.java b/core/src/test/java/org/apache/accumulo/core/util/MonitorUtilTest.java
index c066ca5..907e8e8 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/MonitorUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/MonitorUtilTest.java
@@ -23,30 +23,30 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.mock;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.fate.zookeeper.ZooReader;
import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class MonitorUtilTest {
private ZooReader zr;
private ClientContext context;
- @Before
+ @BeforeEach
public void beforeEachTest() {
zr = mock(ZooReader.class);
context = mock(ClientContext.class);
expect(context.getZooKeeperRoot()).andReturn("/root");
}
- @After
+ @AfterEach
public void afterEachTest() {
verify(zr, context);
}
diff --git a/core/src/test/java/org/apache/accumulo/core/util/NumUtilTest.java b/core/src/test/java/org/apache/accumulo/core/util/NumUtilTest.java
index 174ddb8..c6493de 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/NumUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/NumUtilTest.java
@@ -20,11 +20,11 @@ package org.apache.accumulo.core.util;
import static org.apache.accumulo.core.util.NumUtil.bigNumberForQuantity;
import static org.apache.accumulo.core.util.NumUtil.bigNumberForSize;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Locale;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class NumUtilTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java b/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java
index 6624c2c..2c08c63 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.concurrent.TimeUnit;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 911db1d..b4bbf0e 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
@@ -18,15 +18,15 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.Map.Entry;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class PairTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java b/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
index fa8effb..6a544f1 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Arrays;
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.util.LocalityGroupUtil.Partitioner;
import org.apache.commons.lang3.mutable.MutableLong;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class PartitionerTest {
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/util/PreAllocatedArrayTest.java b/core/src/test/java/org/apache/accumulo/core/util/PreAllocatedArrayTest.java
index 7c48fbd..e9fd8c3 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/PreAllocatedArrayTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/PreAllocatedArrayTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Iterator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class PreAllocatedArrayTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/StatTest.java b/core/src/test/java/org/apache/accumulo/core/util/StatTest.java
index 0bc53c9..b0201ec 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/StatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/StatTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class StatTest {
@@ -30,7 +30,7 @@ public class StatTest {
Stat zero;
Stat stat;
- @Before
+ @BeforeEach
public void setUp() {
zero = new Stat();
zero.addStat(0);
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 845e0d6..d2d223a 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
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test the TextUtil class.
diff --git a/core/src/test/java/org/apache/accumulo/core/util/ThriftMessageUtilTest.java b/core/src/test/java/org/apache/accumulo/core/util/ThriftMessageUtilTest.java
index dbd5d0d..9c75301 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/ThriftMessageUtilTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/ThriftMessageUtilTest.java
@@ -18,21 +18,21 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.accumulo.core.securityImpl.thrift.TAuthenticationTokenIdentifier;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ThriftMessageUtilTest {
private TAuthenticationTokenIdentifier msg;
private ThriftMessageUtil util;
- @Before
+ @BeforeEach
public void setup() throws IOException {
msg = new TAuthenticationTokenIdentifier("principal");
util = new ThriftMessageUtil();
diff --git a/core/src/test/java/org/apache/accumulo/core/util/UnsynchronizedBufferTest.java b/core/src/test/java/org/apache/accumulo/core/util/UnsynchronizedBufferTest.java
index 5e893a0..7e0dc2a 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/UnsynchronizedBufferTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/UnsynchronizedBufferTest.java
@@ -19,17 +19,16 @@
package org.apache.accumulo.core.util;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.nio.ByteBuffer;
-import java.util.Arrays;
import org.apache.hadoop.io.WritableUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class UnsynchronizedBufferTest {
@@ -121,8 +120,8 @@ public class UnsynchronizedBufferTest {
dos.flush();
accumuloBytes = baos.toByteArray();
}
- assertTrue("The byte array written to by UnsynchronizedBuffer is not equal to WritableUtils",
- Arrays.equals(hadoopBytes, accumuloBytes));
+ assertArrayEquals(hadoopBytes, accumuloBytes,
+ "The byte array written to by UnsynchronizedBuffer is not equal to WritableUtils");
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/util/ValidatorTest.java b/core/src/test/java/org/apache/accumulo/core/util/ValidatorTest.java
index c77aa81..acfe49c 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/ValidatorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/ValidatorTest.java
@@ -18,21 +18,21 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Optional;
import org.apache.hadoop.shaded.com.google.re2j.Pattern;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ValidatorTest {
private Validator<String> v, v2, v3;
private static final Pattern STARTSWITH_C = Pattern.compile("c.*");
- @Before
+ @BeforeEach
public void setUp() {
v = new Validator<>(
arg -> "correct".equals(arg) ? Validator.OK : Optional.of("Invalid argument " + arg));
diff --git a/core/src/test/java/org/apache/accumulo/core/util/ValidatorsTest.java b/core/src/test/java/org/apache/accumulo/core/util/ValidatorsTest.java
index 2a60862..8be01d8 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/ValidatorsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/ValidatorsTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.core.util;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import java.util.function.Consumer;
@@ -31,7 +31,7 @@ import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ValidatorsTest {
@@ -48,14 +48,14 @@ public class ValidatorsTest {
}
private static <T> void assertAllValidate(Validator<T> v, List<T> items) {
- assertFalse("nothing to check", items.isEmpty());
+ assertFalse(items.isEmpty(), "nothing to check");
items.forEach(item -> assertSame(item, v.validate(item)));
}
private static <T> void assertAllThrow(Validator<T> v, List<T> items) {
- assertFalse("nothing to check", items.isEmpty());
- items.forEach(item -> assertThrows(String.valueOf(item), IllegalArgumentException.class,
- () -> v.validate(item)));
+ assertFalse(items.isEmpty(), "nothing to check");
+ items.forEach(item -> assertThrows(IllegalArgumentException.class, () -> v.validate(item),
+ String.valueOf(item)));
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/util/compaction/CompactionPrioritizerTest.java b/core/src/test/java/org/apache/accumulo/core/util/compaction/CompactionPrioritizerTest.java
index a3299e7..eae1e99 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/compaction/CompactionPrioritizerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/compaction/CompactionPrioritizerTest.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.core.util.compaction;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.net.URI;
import java.util.ArrayList;
@@ -31,7 +31,7 @@ import java.util.Optional;
import org.apache.accumulo.core.client.admin.compaction.CompactableFile;
import org.apache.accumulo.core.spi.compaction.CompactionJob;
import org.apache.accumulo.core.spi.compaction.CompactionKind;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CompactionPrioritizerTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/DateFormatSupplierTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/DateFormatSupplierTest.java
index d4c7bdb..bc7faba 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/DateFormatSupplierTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/DateFormatSupplierTest.java
@@ -18,16 +18,16 @@
*/
package org.apache.accumulo.core.util.format;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.text.DateFormat;
import java.util.Date;
import java.util.TimeZone;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DateFormatSupplierTest {
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java
index 536da14..108bc0c 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/DateStringFormatterTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.util.format;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
import java.util.TimeZone;
@@ -27,8 +27,8 @@ import java.util.TreeMap;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation")
public class DateStringFormatterTest {
@@ -36,7 +36,7 @@ public class DateStringFormatterTest {
Map<Key,Value> data;
- @Before
+ @BeforeEach
public void setUp() {
formatter = new DateStringFormatter();
data = new TreeMap<>();
@@ -49,7 +49,7 @@ public class DateStringFormatterTest {
assertTrue(formatter.hasNext());
final String next = formatter.next();
- assertTrue(next, next.endsWith("1970/01/01 00:00:00.000"));
+ assertTrue(next.endsWith("1970/01/01 00:00:00.000"), next);
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/DefaultFormatterTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/DefaultFormatterTest.java
index 8637b3d..5cf133b 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/DefaultFormatterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/DefaultFormatterTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.util.format;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Collections;
import java.util.Map;
@@ -30,8 +30,8 @@ import java.util.TreeMap;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class DefaultFormatterTest {
@@ -40,7 +40,7 @@ public class DefaultFormatterTest {
DefaultFormatter df;
Iterable<Entry<Key,Value>> empty = Collections.<Key,Value>emptyMap().entrySet();
- @Before
+ @BeforeEach
public void setUp() {
df = new DefaultFormatter();
}
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 8ba532d..4aba98d 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
@@ -18,16 +18,16 @@
*/
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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.text.DateFormat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FormatterConfigTest {
@@ -41,8 +41,8 @@ public class FormatterConfigTest {
@Test
public void testSetShownLength() {
FormatterConfig config = new FormatterConfig();
- assertThrows("Should throw on negative length.", IllegalArgumentException.class,
- () -> config.setShownLength(-1));
+ assertThrows(IllegalArgumentException.class, () -> config.setShownLength(-1),
+ "Should throw on negative length.");
config.setShownLength(0);
assertEquals(0, config.getShownLength());
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/FormatterFactoryTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/FormatterFactoryTest.java
index af5f55a..f0c9e56 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/FormatterFactoryTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/FormatterFactoryTest.java
@@ -18,21 +18,21 @@
*/
package org.apache.accumulo.core.util.format;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collections;
import java.util.Map.Entry;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FormatterFactoryTest {
Iterable<Entry<Key,Value>> scanner;
- @Before
+ @BeforeEach
public void setUp() {
scanner = Collections.<Key,Value>emptyMap().entrySet();
}
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/HexFormatterTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/HexFormatterTest.java
index 1c3ce1b..2e4558d 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/HexFormatterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/HexFormatterTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.core.util.format;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
import java.util.TreeMap;
@@ -28,15 +28,15 @@ import java.util.TreeMap;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class HexFormatterTest {
HexFormatter formatter;
Map<Key,Value> data;
- @Before
+ @BeforeEach
public void setUp() {
data = new TreeMap<>();
formatter = new HexFormatter();
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatterTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatterTest.java
index e522708..0c38739 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/ShardedTableDistributionFormatterTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.core.util.format;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.List;
@@ -28,15 +28,15 @@ import java.util.TreeMap;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ShardedTableDistributionFormatterTest {
ShardedTableDistributionFormatter formatter;
Map<Key,Value> data;
- @Before
+ @BeforeEach
public void setUp() {
data = new TreeMap<>();
formatter = new ShardedTableDistributionFormatter();
diff --git a/core/src/test/java/org/apache/accumulo/core/util/format/StatisticsDisplayFormatterTest.java b/core/src/test/java/org/apache/accumulo/core/util/format/StatisticsDisplayFormatterTest.java
index 6d59b9f..8d57df3 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/format/StatisticsDisplayFormatterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/format/StatisticsDisplayFormatterTest.java
@@ -18,24 +18,24 @@
*/
package org.apache.accumulo.core.util.format;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
import java.util.TreeMap;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class StatisticsDisplayFormatterTest {
StatisticsDisplayFormatter formatter;
Map<Key,Value> data;
- @Before
+ @BeforeEach
public void setUp() {
data = new TreeMap<>();
formatter = new StatisticsDisplayFormatter();
diff --git a/core/src/test/java/org/apache/accumulo/core/volume/VolumeImplTest.java b/core/src/test/java/org/apache/accumulo/core/volume/VolumeImplTest.java
index a46766c..b8c5c75 100644
--- a/core/src/test/java/org/apache/accumulo/core/volume/VolumeImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/volume/VolumeImplTest.java
@@ -22,10 +22,10 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
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.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.net.URI;
@@ -34,7 +34,7 @@ import java.util.Set;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.LoggerFactory;
public class VolumeImplTest {
diff --git a/core/src/test/java/org/apache/accumulo/fate/AgeOffStoreTest.java b/core/src/test/java/org/apache/accumulo/fate/AgeOffStoreTest.java
index 291a97d..439edd5 100644
--- a/core/src/test/java/org/apache/accumulo/fate/AgeOffStoreTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/AgeOffStoreTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.fate;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashSet;
import java.util.Set;
@@ -26,7 +26,7 @@ import java.util.Set;
import org.apache.accumulo.fate.AgeOffStore.TimeSource;
import org.apache.accumulo.fate.ReadOnlyTStore.TStatus;
import org.apache.zookeeper.KeeperException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AgeOffStoreTest {
diff --git a/core/src/test/java/org/apache/accumulo/fate/ReadOnlyStoreTest.java b/core/src/test/java/org/apache/accumulo/fate/ReadOnlyStoreTest.java
index b8255a3..5ee9de9 100644
--- a/core/src/test/java/org/apache/accumulo/fate/ReadOnlyStoreTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/ReadOnlyStoreTest.java
@@ -18,15 +18,15 @@
*/
package org.apache.accumulo.fate;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.util.Collections;
import java.util.EnumSet;
import org.apache.accumulo.fate.ReadOnlyTStore.TStatus;
import org.easymock.EasyMock;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Make sure read only decorate passes read methods.
diff --git a/core/src/test/java/org/apache/accumulo/fate/util/RetryTest.java b/core/src/test/java/org/apache/accumulo/fate/util/RetryTest.java
index 72e3c9b..daf1631 100644
--- a/core/src/test/java/org/apache/accumulo/fate/util/RetryTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/util/RetryTest.java
@@ -23,10 +23,10 @@ import static java.util.concurrent.TimeUnit.HOURS;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.concurrent.TimeUnit;
@@ -37,8 +37,8 @@ import org.apache.accumulo.fate.util.Retry.NeedsRetryDelay;
import org.apache.accumulo.fate.util.Retry.NeedsTimeIncrement;
import org.apache.accumulo.fate.util.Retry.RetryFactory;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
public class RetryTest {
@@ -52,7 +52,7 @@ public class RetryTest {
private Retry unlimitedRetry;
private static final TimeUnit MS = MILLISECONDS;
- @Before
+ @BeforeEach
public void setup() {
retry = Retry.builder().maxRetries(MAX_RETRIES).retryAfter(INITIAL_WAIT, MS)
.incrementBy(WAIT_INC, MS).maxWait(MAX_RETRIES * WAIT_INC, MS).backOffFactor(BACKOFF_FACTOR)
@@ -96,8 +96,8 @@ public class RetryTest {
retry.useRetry();
}
assertFalse(retry.canRetry());
- assertThrows("Calling useRetry when canRetry returns false throws an exception",
- IllegalStateException.class, () -> retry.useRetry());
+ assertThrows(IllegalStateException.class, () -> retry.useRetry(),
+ "Calling useRetry when canRetry returns false throws an exception");
}
@Test
@@ -237,8 +237,8 @@ public class RetryTest {
NeedsRetries builder = Retry.builder();
builder.maxRetries(10);
builder.maxRetries(0);
- assertThrows("Should not allow negative retries", IllegalArgumentException.class,
- () -> builder.maxRetries(-1));
+ assertThrows(IllegalArgumentException.class, () -> builder.maxRetries(-1),
+ "Should not allow negative retries");
}
@Test
@@ -251,8 +251,8 @@ public class RetryTest {
builder.retryAfter(0, MILLISECONDS);
builder.retryAfter(0, DAYS);
- assertThrows("Should not allow negative wait times", IllegalArgumentException.class,
- () -> builder.retryAfter(-1, NANOSECONDS));
+ assertThrows(IllegalArgumentException.class, () -> builder.retryAfter(-1, NANOSECONDS),
+ "Should not allow negative wait times");
}
@Test
@@ -265,8 +265,8 @@ public class RetryTest {
builder.incrementBy(0, HOURS);
builder.incrementBy(0, NANOSECONDS);
- assertThrows("Should not allow negative increments", IllegalArgumentException.class,
- () -> builder.incrementBy(-1, NANOSECONDS));
+ assertThrows(IllegalArgumentException.class, () -> builder.incrementBy(-1, NANOSECONDS),
+ "Should not allow negative increments");
}
@Test
@@ -276,8 +276,8 @@ public class RetryTest {
builder.maxWait(15, MILLISECONDS);
builder.maxWait(16, MILLISECONDS);
- assertThrows("Max wait time should be greater than or equal to initial wait time",
- IllegalArgumentException.class, () -> builder.maxWait(14, MILLISECONDS));
+ assertThrows(IllegalArgumentException.class, () -> builder.maxWait(14, MILLISECONDS),
+ "Max wait time should be greater than or equal to initial wait time");
}
@Test
@@ -291,8 +291,8 @@ public class RetryTest {
builder.logInterval(0, HOURS);
builder.logInterval(0, NANOSECONDS);
- assertThrows("Log interval must not be negative", IllegalArgumentException.class,
- () -> builder.logInterval(-1, NANOSECONDS));
+ assertThrows(IllegalArgumentException.class, () -> builder.logInterval(-1, NANOSECONDS),
+ "Log interval must not be negative");
}
@Test
diff --git a/core/src/test/java/org/apache/accumulo/fate/zookeeper/DistributedReadWriteLockTest.java b/core/src/test/java/org/apache/accumulo/fate/zookeeper/DistributedReadWriteLockTest.java
index 4b66384..b4c87dd 100644
--- a/core/src/test/java/org/apache/accumulo/fate/zookeeper/DistributedReadWriteLockTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/zookeeper/DistributedReadWriteLockTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.fate.zookeeper;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -28,7 +28,7 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import org.apache.accumulo.fate.zookeeper.DistributedReadWriteLock.QueueLock;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DistributedReadWriteLockTest {
diff --git a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ServiceLockTest.java b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ServiceLockTest.java
index d7c3c18..0620a7a 100644
--- a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ServiceLockTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ServiceLockTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.accumulo.fate.zookeeper;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ServiceLockTest {
diff --git a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactoryTest.java b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactoryTest.java
index 13f4e5c..f9a0d62 100644
--- a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactoryTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactoryTest.java
@@ -19,24 +19,24 @@
package org.apache.accumulo.fate.zookeeper;
import static org.easymock.EasyMock.createMock;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
import org.apache.zookeeper.Watcher;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ZooCacheFactoryTest {
private ZooCacheFactory zcf;
- @Before
+ @BeforeEach
public void setUp() {
zcf = new ZooCacheFactory();
}
- @After
+ @AfterEach
public void tearDown() {
zcf.reset();
}
diff --git a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooCacheTest.java b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooCacheTest.java
index f33c698..e5e51ae 100644
--- a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooCacheTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooCacheTest.java
@@ -27,12 +27,12 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
@@ -44,8 +44,8 @@ import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.easymock.Capture;
import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ZooCacheTest {
private static final String ZPATH = "/some/path/in/zk";
@@ -56,7 +56,7 @@ public class ZooCacheTest {
private ZooKeeper zk;
private ZooCache zc;
- @Before
+ @BeforeEach
public void setUp() {
zr = createMock(ZooReader.class);
zk = createStrictMock(ZooKeeper.class);
diff --git a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriterTest.java b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriterTest.java
index ce93c6b..2aa0b79 100644
--- a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriterTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooReaderWriterTest.java
@@ -24,8 +24,8 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.accumulo.fate.util.Retry;
import org.apache.accumulo.fate.util.Retry.RetryFactory;
@@ -39,8 +39,8 @@ import org.apache.zookeeper.KeeperException.NodeExistsException;
import org.apache.zookeeper.KeeperException.SessionExpiredException;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ZooReaderWriterTest {
@@ -49,7 +49,7 @@ public class ZooReaderWriterTest {
private RetryFactory retryFactory;
private Retry retry;
- @Before
+ @BeforeEach
public void setup() {
zk = createMock(ZooKeeper.class);
zrw = createMockBuilder(ZooReaderWriter.class)
diff --git a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooSessionTest.java b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooSessionTest.java
index c63b0ff..f0ce3a2 100644
--- a/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooSessionTest.java
+++ b/core/src/test/java/org/apache/accumulo/fate/zookeeper/ZooSessionTest.java
@@ -18,17 +18,19 @@
*/
package org.apache.accumulo.fate.zookeeper;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.zookeeper.ZooKeeper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
public class ZooSessionTest {
private static final int MINIMUM_TIMEOUT = 10000;
private static final String UNKNOWN_HOST = "hostname.that.should.not.exist.example.com:2181";
- @Test(timeout = MINIMUM_TIMEOUT * 4)
+ @Test
+ @Timeout(MINIMUM_TIMEOUT * 4)
public void testUnknownHost() {
assertThrows(RuntimeException.class, () -> {
ZooKeeper session = ZooSession.connect(UNKNOWN_HOST, MINIMUM_TIMEOUT, null, null, null);
diff --git a/hadoop-mapreduce/pom.xml b/hadoop-mapreduce/pom.xml
index 290612d..447aa7c 100644
--- a/hadoop-mapreduce/pom.xml
+++ b/hadoop-mapreduce/pom.xml
@@ -56,11 +56,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-minicluster</artifactId>
<scope>test</scope>
@@ -80,6 +75,11 @@
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/iterator-test-harness/pom.xml b/iterator-test-harness/pom.xml
index c024a78..c11ea13 100644
--- a/iterator-test-harness/pom.xml
+++ b/iterator-test-harness/pom.xml
@@ -34,11 +34,6 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
- <!--TODO Don't force downstream users to have JUnit -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-core</artifactId>
@@ -48,6 +43,10 @@
<artifactId>hadoop-client-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
diff --git a/minicluster/pom.xml b/minicluster/pom.xml
index c7ee174..afe56a9 100644
--- a/minicluster/pom.xml
+++ b/minicluster/pom.xml
@@ -114,11 +114,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<scope>test</scope>
@@ -143,6 +138,11 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<pluginManagement>
diff --git a/pom.xml b/pom.xml
index 902a0aa..2018882 100644
--- a/pom.xml
+++ b/pom.xml
@@ -234,6 +234,13 @@
<scope>import</scope>
</dependency>
<dependency>
+ <groupId>org.junit</groupId>
+ <artifactId>junit-bom</artifactId>
+ <version>5.8.2</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.82</version>
@@ -316,11 +323,6 @@
<version>1.2</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
- </dependency>
- <dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-compaction-coordinator</artifactId>
<version>${project.version}</version>
@@ -972,6 +974,8 @@
<usedUndeclaredDependency>org.apache.httpcomponents:httpcore:jar:*</usedUndeclaredDependency>
<usedUndeclaredDependency>org.powermock:powermock-core:jar:*</usedUndeclaredDependency>
<usedUndeclaredDependency>org.powermock:powermock-reflect:jar:*</usedUndeclaredDependency>
+ <!-- This should be removed upon completion of migrating junit 4 to 5 -->
+ <usedUndeclaredDependency>junit:junit:jar:*</usedUndeclaredDependency>
</ignoredUsedUndeclaredDependencies>
<ignoredUnusedDeclaredDependencies>
<!-- auto-service isn't used in every module -->
@@ -985,7 +989,6 @@
-
<unusedDeclaredDependency>org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:jar:*</unusedDeclaredDependency>
<unusedDeclaredDependency>org.powermock:powermock-api-easymock:jar:*</unusedDeclaredDependency>
- <unusedDeclaredDependency>junit:junit:jar:*</unusedDeclaredDependency>
<!-- spotbugs annotations may or may not be used in each module -->
<unusedDeclaredDependency>com.github.spotbugs:spotbugs-annotations:jar:*</unusedDeclaredDependency>
<!-- ignore unused native; analysis isn't possible with tar.gz dependency -->
@@ -994,6 +997,8 @@
<unusedDeclaredDependency>org.apache.logging.log4j:log4j-1.2-api:jar:*</unusedDeclaredDependency>
<unusedDeclaredDependency>org.apache.logging.log4j:log4j-slf4j-impl:jar:*</unusedDeclaredDependency>
<unusedDeclaredDependency>org.apache.logging.log4j:log4j-web:jar:*</unusedDeclaredDependency>
+ <!-- This should be removed upon completion of migrating junit 4 to 5 -->
+ <unusedDeclaredDependency>org.junit.vintage:junit-vintage-engine:jar:*</unusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
</configuration>
</execution>
@@ -1094,6 +1099,10 @@
<property name="message" value="Use static imports for Assert.* methods for consistency" />
</module>
<module name="RegexpSinglelineJava">
+ <property name="format" value="org[.]junit[.]jupiter[.]api[.]Assertions;" />
+ <property name="message" value="Use static imports for Assert.* methods for consistency" />
+ </module>
+ <module name="RegexpSinglelineJava">
<property name="format" value="import java[.]nio[.]charset[.]StandardCharsets;" />
<property name="message" value="Use static imports for StandardCharsets.* constants for consistency" />
</module>
diff --git a/server/base/pom.xml b/server/base/pom.xml
index 2fded91..91f1024 100644
--- a/server/base/pom.xml
+++ b/server/base/pom.xml
@@ -110,11 +110,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
@@ -124,6 +119,11 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<testResources>
diff --git a/server/compaction-coordinator/pom.xml b/server/compaction-coordinator/pom.xml
index b8c4e59..11c962a 100644
--- a/server/compaction-coordinator/pom.xml
+++ b/server/compaction-coordinator/pom.xml
@@ -77,11 +77,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
@@ -92,6 +87,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<scope>test</scope>
diff --git a/server/compactor/pom.xml b/server/compactor/pom.xml
index 82c5c93..3f314ec 100644
--- a/server/compactor/pom.xml
+++ b/server/compactor/pom.xml
@@ -80,11 +80,6 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
@@ -95,6 +90,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<scope>test</scope>
diff --git a/server/gc/pom.xml b/server/gc/pom.xml
index e21373d..d5630e7 100644
--- a/server/gc/pom.xml
+++ b/server/gc/pom.xml
@@ -86,11 +86,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
@@ -100,5 +95,10 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/server/manager/pom.xml b/server/manager/pom.xml
index b161f2e..018dc59 100644
--- a/server/manager/pom.xml
+++ b/server/manager/pom.xml
@@ -110,11 +110,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
@@ -124,5 +119,10 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/server/monitor/pom.xml b/server/monitor/pom.xml
index 2ed9295..f4df1f4 100644
--- a/server/monitor/pom.xml
+++ b/server/monitor/pom.xml
@@ -156,11 +156,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
@@ -186,6 +181,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<scope>test</scope>
diff --git a/server/native/pom.xml b/server/native/pom.xml
index 37ed30d..372ceec 100644
--- a/server/native/pom.xml
+++ b/server/native/pom.xml
@@ -41,13 +41,13 @@
<optional>true</optional>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/server/tserver/pom.xml b/server/tserver/pom.xml
index ca687b0..be5747f 100644
--- a/server/tserver/pom.xml
+++ b/server/tserver/pom.xml
@@ -110,11 +110,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
@@ -124,6 +119,11 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<pluginManagement>
diff --git a/shell/pom.xml b/shell/pom.xml
index 107e31e..aceeb2f 100644
--- a/shell/pom.xml
+++ b/shell/pom.xml
@@ -101,11 +101,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
@@ -116,6 +111,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<scope>test</scope>
diff --git a/start/pom.xml b/start/pom.xml
index 5edaf19..a959f4e 100644
--- a/start/pom.xml
+++ b/start/pom.xml
@@ -60,11 +60,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-minicluster</artifactId>
<scope>test</scope>
@@ -80,6 +75,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<scope>test</scope>
diff --git a/test/pom.xml b/test/pom.xml
index 1fce905..78fb227 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -79,10 +79,6 @@
<artifactId>opentelemetry-context</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-compaction-coordinator</artifactId>
</dependency>
@@ -199,6 +195,10 @@
<artifactId>jline</artifactId>
</dependency>
<dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>