You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2022/02/09 17:10:55 UTC

[hbase] branch branch-2.5 updated: HBASE-26709 Ban the usage of junit 3 TestCase (#4065)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.5 by this push:
     new b64a507  HBASE-26709 Ban the usage of junit 3 TestCase (#4065)
b64a507 is described below

commit b64a507340e6385cf6b6c647d11e411a6dfa03c5
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Thu Jan 27 13:41:48 2022 +0800

    HBASE-26709 Ban the usage of junit 3 TestCase (#4065)
    
    Signed-off-by: Nick Dimiduk <nd...@apache.org>
---
 .../org/apache/hadoop/hbase/util/TestBytes.java    | 44 +++++++++++++-
 .../hadoop/hbase/http/conf/TestConfServlet.java    |  9 ++-
 .../org/apache/hadoop/hbase/HBaseTestCase.java     | 20 +++----
 .../org/apache/hadoop/hbase/client/TestResult.java | 30 +++++++---
 .../coprocessor/TestRegionObserverStacking.java    | 23 +++----
 .../TestFirstKeyValueMatchingQualifiersFilter.java |  7 +--
 .../hbase/io/TestImmutableBytesWritable.java       | 13 +++-
 .../hbase/io/hfile/TestCachedBlockQueue.java       | 70 +++++++++++-----------
 .../hadoop/hbase/io/hfile/TestHFileSeek.java       | 13 ++--
 .../hbase/regionserver/TestCellSkipListSet.java    | 33 ++++++----
 .../regionserver/TestKeyValueScanFixture.java      | 11 ++--
 .../hadoop/hbase/util/TestBloomFilterChunk.java    | 15 +++--
 .../hadoop/hbase/util/TestConnectionCache.java     | 31 ++++++----
 .../org/apache/hadoop/hbase/util/TestRootPath.java |  7 ++-
 pom.xml                                            |  8 +++
 15 files changed, 216 insertions(+), 118 deletions(-)

diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestBytes.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestBytes.java
index 113eae1..decb6ce 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestBytes.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestBytes.java
@@ -18,6 +18,13 @@
 package org.apache.hadoop.hbase.util;
 
 import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
@@ -31,17 +38,17 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Random;
-import junit.framework.TestCase;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.testclassification.MiscTests;
 import org.apache.hadoop.io.WritableUtils;
 import org.junit.Assert;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category({MiscTests.class, MediumTests.class})
-public class TestBytes extends TestCase {
+public class TestBytes {
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestBytes.class);
@@ -61,10 +68,12 @@ public class TestBytes extends TestCase {
     assertEquals(Bytes.UNSAFE_UNALIGNED, value);
   }
 
+  @Test
   public void testShort() throws Exception  {
     testShort(false);
   }
 
+  @Test
   public void testShortUnsafe() throws Exception  {
     testShort(true);
   }
@@ -88,6 +97,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testNullHashCode() {
     byte [] b = null;
     Exception ee = null;
@@ -99,6 +109,7 @@ public class TestBytes extends TestCase {
     assertNotNull(ee);
   }
 
+  @Test
   public void testAdd() {
     byte[] a = {0,0,0,0,0,0,0,0,0,0};
     byte[] b = {1,1,1,1,1,1,1,1,1,1,1};
@@ -112,6 +123,7 @@ public class TestBytes extends TestCase {
     assertEquals(0, Bytes.compareTo(result1, result2));
   }
 
+  @Test
   public void testSplit() {
     byte[] lowest = Bytes.toBytes("AAA");
     byte[] middle = Bytes.toBytes("CCC");
@@ -133,6 +145,7 @@ public class TestBytes extends TestCase {
     assertTrue(Bytes.equals(parts[2], middle));
   }
 
+  @Test
   public void testSplit2() {
     // More split tests.
     byte [] lowest = Bytes.toBytes("http://A");
@@ -146,6 +159,7 @@ public class TestBytes extends TestCase {
     assertTrue(Bytes.equals(parts[1], middle));
   }
 
+  @Test
   public void testSplit3() {
     // Test invalid split cases
     byte[] low = { 1, 1, 1 };
@@ -180,6 +194,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToInt() {
     int[] ints = { -1, 123, Integer.MIN_VALUE, Integer.MAX_VALUE };
     for (int anInt : ints) {
@@ -191,6 +206,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToLong() {
     long[] longs = { -1L, 123L, Long.MIN_VALUE, Long.MAX_VALUE };
     for (long aLong : longs) {
@@ -202,6 +218,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToFloat() {
     float[] floats = { -1f, 123.123f, Float.MAX_VALUE };
     for (float aFloat : floats) {
@@ -212,6 +229,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToDouble() {
     double [] doubles = {Double.MIN_VALUE, Double.MAX_VALUE};
     for (double aDouble : doubles) {
@@ -222,6 +240,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToBigDecimal() {
     BigDecimal[] decimals = { new BigDecimal("-1"), new BigDecimal("123.123"),
       new BigDecimal("123123123123") };
@@ -241,6 +260,7 @@ public class TestBytes extends TestCase {
     return result;
   }
 
+  @Test
   public void testToBytesForByteBuffer() {
     byte[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     ByteBuffer target = ByteBuffer.wrap(array);
@@ -264,6 +284,7 @@ public class TestBytes extends TestCase {
     assertEquals(5, target2.limit());
   }
 
+  @Test
   public void testGetBytesForByteBuffer() {
     byte[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     ByteBuffer target = ByteBuffer.wrap(array);
@@ -277,6 +298,7 @@ public class TestBytes extends TestCase {
     assertEquals(7, target.limit());
   }
 
+  @Test
   public void testReadAsVLong() throws Exception {
     long[] longs = { -1L, 123L, Long.MIN_VALUE, Long.MAX_VALUE };
     for (long aLong : longs) {
@@ -290,6 +312,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToStringBinaryForBytes() {
     byte[] array = { '0', '9', 'a', 'z', 'A', 'Z', '@', 1 };
     String actual = Bytes.toStringBinary(array);
@@ -301,6 +324,7 @@ public class TestBytes extends TestCase {
     assertEquals(expected2, actual2);
   }
 
+  @Test
   public void testToStringBinaryForArrayBasedByteBuffer() {
     byte[] array = { '0', '9', 'a', 'z', 'A', 'Z', '@', 1 };
     ByteBuffer target = ByteBuffer.wrap(array);
@@ -309,6 +333,7 @@ public class TestBytes extends TestCase {
     assertEquals(expected, actual);
   }
 
+  @Test
   public void testToStringBinaryForReadOnlyByteBuffer() {
     byte[] array = { '0', '9', 'a', 'z', 'A', 'Z', '@', 1 };
     ByteBuffer target = ByteBuffer.wrap(array).asReadOnlyBuffer();
@@ -317,6 +342,7 @@ public class TestBytes extends TestCase {
     assertEquals(expected, actual);
   }
 
+  @Test
   public void testBinarySearch() {
     byte[][] arr = {
         { 1 },
@@ -357,6 +383,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToStringBytesBinaryReversible() {
     //  let's run test with 1000 randomly generated byte arrays
     Random rand = new Random(EnvironmentEdgeManager.currentTime());
@@ -381,6 +408,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testStartsWith() {
     assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("h")));
     assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("")));
@@ -389,6 +417,7 @@ public class TestBytes extends TestCase {
     assertFalse(Bytes.startsWith(Bytes.toBytes(""), Bytes.toBytes("hello")));
   }
 
+  @Test
   public void testIncrementBytes() {
     assertTrue(checkTestIncrementBytes(10, 1));
     assertTrue(checkTestIncrementBytes(12, 123435445));
@@ -423,6 +452,7 @@ public class TestBytes extends TestCase {
     return (Bytes.toLong(testValue) + amount) == incrementResult;
   }
 
+  @Test
   public void testFixedSizeString() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream dos = new DataOutputStream(baos);
@@ -448,6 +478,7 @@ public class TestBytes extends TestCase {
     assertEquals("", Bytes.readStringFixedSize(dis, 9));
   }
 
+  @Test
   public void testCopy() {
     byte[] bytes = Bytes.toBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
     byte[] copy =  Bytes.copy(bytes);
@@ -455,6 +486,7 @@ public class TestBytes extends TestCase {
     assertTrue(Bytes.equals(bytes, copy));
   }
 
+  @Test
   public void testToBytesBinaryTrailingBackslashes() {
     try {
       Bytes.toBytesBinary("abc\\x00\\x01\\");
@@ -463,11 +495,13 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToStringBinary_toBytesBinary_Reversable() {
     String bytes = Bytes.toStringBinary(Bytes.toBytes(2.17));
     assertEquals(2.17, Bytes.toDouble(Bytes.toBytesBinary(bytes)), 0);
   }
 
+  @Test
   public void testUnsignedBinarySearch(){
     byte[] bytes = new byte[] { 0,5,123,127,-128,-100,-1 };
     Assert.assertEquals(1, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte)5));
@@ -479,6 +513,7 @@ public class TestBytes extends TestCase {
     Assert.assertEquals(-6-1, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte)-5));
   }
 
+  @Test
   public void testUnsignedIncrement(){
     byte[] a = Bytes.toBytes(0);
     int a2 = Bytes.toInt(Bytes.unsignedCopyAndIncrement(a), 0);
@@ -495,6 +530,7 @@ public class TestBytes extends TestCase {
     Assert.assertEquals(256, c2);
   }
 
+  @Test
   public void testIndexOf() {
     byte[] array = Bytes.toBytes("hello");
     assertEquals(1, Bytes.indexOf(array, (byte) 'e'));
@@ -505,6 +541,7 @@ public class TestBytes extends TestCase {
     assertEquals(-1, Bytes.indexOf(array, Bytes.toBytes("hll")));
   }
 
+  @Test
   public void testContains() {
     byte[] array = Bytes.toBytes("hello world");
     assertTrue(Bytes.contains(array, (byte) 'e'));
@@ -515,6 +552,7 @@ public class TestBytes extends TestCase {
     assertFalse(Bytes.contains(array, Bytes.toBytes("owo")));
   }
 
+  @Test
   public void testZero() {
     byte[] array = Bytes.toBytes("hello");
     Bytes.zero(array);
@@ -533,6 +571,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testPutBuffer() {
     byte[] b = new byte[100];
     for (byte i = 0; i < 100; i++) {
@@ -543,6 +582,7 @@ public class TestBytes extends TestCase {
     }
   }
 
+  @Test
   public void testToFromHex() {
     List<String> testStrings = new ArrayList<>(8);
     testStrings.addAll(Arrays.asList("", "00", "A0", "ff", "FFffFFFFFFFFFF", "12",
diff --git a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/conf/TestConfServlet.java b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/conf/TestConfServlet.java
index c07ed0a..ac2ef8f 100644
--- a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/conf/TestConfServlet.java
+++ b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/conf/TestConfServlet.java
@@ -17,6 +17,10 @@
  */
 package org.apache.hadoop.hbase.http.conf;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.util.HashSet;
@@ -24,7 +28,6 @@ import java.util.Map;
 import java.util.Set;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import junit.framework.TestCase;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.MiscTests;
@@ -44,8 +47,8 @@ import org.apache.hbase.thirdparty.org.eclipse.jetty.util.ajax.JSON;
  * Basic test case that the ConfServlet can write configuration
  * to its output in XML and JSON format.
  */
-@Category({MiscTests.class, SmallTests.class})
-public class TestConfServlet extends TestCase {
+@Category({ MiscTests.class, SmallTests.class })
+public class TestConfServlet {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestCase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestCase.java
index ea162fc2..5687a04 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestCase.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestCase.java
@@ -21,8 +21,6 @@ package org.apache.hadoop.hbase;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.NavigableMap;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -51,7 +49,7 @@ import org.slf4j.LoggerFactory;
  * @see <a href="https://issues.apache.org/jira/browse/HBASE-11912">HBASE-11912</a>
  */
 @Deprecated
-public abstract class HBaseTestCase extends TestCase {
+public abstract class HBaseTestCase extends junit.framework.TestCase {
   private static final Logger LOG = LoggerFactory.getLogger(HBaseTestCase.class);
 
   protected final static byte [] fam1 = Bytes.toBytes("colfamily11");
@@ -432,21 +430,17 @@ public abstract class HBaseTestCase extends TestCase {
     HBaseTestingUtility.closeRegionAndWAL(meta);
   }
 
-  public static void assertByteEquals(byte[] expected,
-                               byte[] actual) {
+  public static void assertByteEquals(byte[] expected, byte[] actual) {
     if (Bytes.compareTo(expected, actual) != 0) {
-      throw new AssertionFailedError("expected:<" +
-      Bytes.toString(expected) + "> but was:<" +
-      Bytes.toString(actual) + ">");
+      throw new junit.framework.AssertionFailedError(
+        "expected:<" + Bytes.toString(expected) + "> but was:<" + Bytes.toString(actual) + ">");
     }
   }
 
-  public static void assertEquals(byte[] expected,
-                               byte[] actual) {
+  public static void assertEquals(byte[] expected, byte[] actual) {
     if (Bytes.compareTo(expected, actual) != 0) {
-      throw new AssertionFailedError("expected:<" +
-      Bytes.toStringBinary(expected) + "> but was:<" +
-      Bytes.toStringBinary(actual) + ">");
+      throw new junit.framework.AssertionFailedError("expected:<" + Bytes.toStringBinary(expected) +
+        "> but was:<" + Bytes.toStringBinary(actual) + ">");
     }
   }
 }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResult.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResult.java
index cc0b17a..e763aa6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResult.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResult.java
@@ -19,9 +19,13 @@ package org.apache.hadoop.hbase.client;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.lessThan;
 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.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -29,7 +33,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.NoSuchElementException;
-import junit.framework.TestCase;
 import org.apache.hadoop.hbase.ArrayBackedTag;
 import org.apache.hadoop.hbase.ByteBufferKeyValue;
 import org.apache.hadoop.hbase.Cell;
@@ -44,12 +47,13 @@ import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.util.ByteBufferUtils;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Category({SmallTests.class, ClientTests.class})
-public class TestResult extends TestCase {
+@Category({ SmallTests.class, ClientTests.class })
+public class TestResult {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
@@ -79,8 +83,8 @@ public class TestResult extends TestCase {
 
   /**
    * Run some tests to ensure Result acts like a proper CellScanner.
-   * @throws IOException
    */
+  @Test
   public void testResultAsCellScanner() throws IOException {
     Cell [] cells = genKVs(row, family, value, 1, 10);
     Arrays.sort(cells, CellComparator.getInstance());
@@ -102,6 +106,7 @@ public class TestResult extends TestCase {
     assertEquals(cells.length, count);
   }
 
+  @Test
   public void testBasicGetColumn() throws Exception {
     KeyValue [] kvs = genKVs(row, family, value, 1, 100);
 
@@ -119,12 +124,14 @@ public class TestResult extends TestCase {
     }
   }
 
+  @Test
   public void testCurrentOnEmptyCell() throws IOException {
     Result r = Result.create(new Cell[0]);
     assertFalse(r.advance());
     assertNull(r.current());
   }
 
+  @Test
   public void testAdvanceTwiceOnEmptyCell() throws IOException {
     Result r = Result.create(new Cell[0]);
     assertFalse(r.advance());
@@ -136,6 +143,7 @@ public class TestResult extends TestCase {
     }
   }
 
+  @Test
   public void testMultiVersionGetColumn() throws Exception {
     KeyValue [] kvs1 = genKVs(row, family, value, 1, 100);
     KeyValue [] kvs2 = genKVs(row, family, value, 200, 100);
@@ -158,6 +166,7 @@ public class TestResult extends TestCase {
     }
   }
 
+  @Test
   public void testBasicGetValue() throws Exception {
     KeyValue [] kvs = genKVs(row, family, value, 1, 100);
 
@@ -173,6 +182,7 @@ public class TestResult extends TestCase {
     }
   }
 
+  @Test
   public void testMultiVersionGetValue() throws Exception {
     KeyValue [] kvs1 = genKVs(row, family, value, 1, 100);
     KeyValue [] kvs2 = genKVs(row, family, value, 200, 100);
@@ -192,6 +202,7 @@ public class TestResult extends TestCase {
     }
   }
 
+  @Test
   public void testBasicLoadValue() throws Exception {
     KeyValue [] kvs = genKVs(row, family, value, 1, 100);
 
@@ -212,6 +223,7 @@ public class TestResult extends TestCase {
     }
   }
 
+  @Test
   public void testMultiVersionLoadValue() throws Exception {
     KeyValue [] kvs1 = genKVs(row, family, value, 1, 100);
     KeyValue [] kvs2 = genKVs(row, family, value, 200, 100);
@@ -240,6 +252,7 @@ public class TestResult extends TestCase {
   /**
    * Verify that Result.compareResults(...) behaves correctly.
    */
+  @Test
   public void testCompareResults() throws Exception {
     byte [] value1 = Bytes.toBytes("value1");
     byte [] qual = Bytes.toBytes("qual");
@@ -260,6 +273,7 @@ public class TestResult extends TestCase {
     }
   }
 
+  @Test
   public void testCompareResultsWithTags() throws Exception {
     Tag t1 = new ArrayBackedTag((byte) 1, Bytes.toBytes("TAG1"));
     Tag t2 = new ArrayBackedTag((byte) 2, Bytes.toBytes("TAG2"));
@@ -374,6 +388,7 @@ public class TestResult extends TestCase {
     }
   }
 
+  @Test
   public void testCompareResultMemoryUsage() {
     List<Cell> cells1 = new ArrayList<>();
     for (long i = 0; i < 100; i++) {
@@ -392,7 +407,7 @@ public class TestResult extends TestCase {
       fail();
     } catch (Exception x) {
       assertTrue(x.getMessage().startsWith("This result was different:"));
-      assertThat(x.getMessage().length(), is(greaterThan(100)));
+      assertThat(x.getMessage().length(), greaterThan(100));
     }
 
     try {
@@ -400,7 +415,7 @@ public class TestResult extends TestCase {
       fail();
     } catch (Exception x) {
       assertEquals("This result was different: row=row", x.getMessage());
-      assertThat(x.getMessage().length(), is(lessThan(100)));
+      assertThat(x.getMessage().length(), lessThan(100));
     }
   }
 
@@ -429,6 +444,7 @@ public class TestResult extends TestCase {
   /**
    * Verifies that one can't modify instance of EMPTY_RESULT.
    */
+  @Test
   public void testEmptyResultIsReadonly() {
     Result emptyResult = Result.EMPTY_RESULT;
     Result otherResult = new Result();
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
index 991ffe8..ea02f17 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
@@ -17,9 +17,10 @@
  */
 package org.apache.hadoop.hbase.coprocessor;
 
+import static org.junit.Assert.assertTrue;
+
 import java.io.IOException;
 import java.util.Optional;
-import junit.framework.TestCase;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Coprocessor;
@@ -40,13 +41,15 @@ import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.hbase.wal.WALEdit;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.mockito.Mockito;
 
 @Category({CoprocessorTests.class, SmallTests.class})
-public class TestRegionObserverStacking extends TestCase {
+public class TestRegionObserverStacking {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
@@ -70,10 +73,7 @@ public class TestRegionObserverStacking extends TestCase {
         final Durability durability)
         throws IOException {
       id = EnvironmentEdgeManager.currentTime();
-      try {
-        Thread.sleep(10);
-      } catch (InterruptedException ex) {
-      }
+      Threads.sleepWithoutInterrupt(10);
     }
   }
 
@@ -91,10 +91,7 @@ public class TestRegionObserverStacking extends TestCase {
         final Durability durability)
         throws IOException {
       id = EnvironmentEdgeManager.currentTime();
-      try {
-        Thread.sleep(10);
-      } catch (InterruptedException ex) {
-      }
+      Threads.sleepWithoutInterrupt(10);
     }
   }
 
@@ -112,10 +109,7 @@ public class TestRegionObserverStacking extends TestCase {
         final Durability durability)
         throws IOException {
       id = EnvironmentEdgeManager.currentTime();
-      try {
-        Thread.sleep(10);
-      } catch (InterruptedException ex) {
-      }
+      Threads.sleepWithoutInterrupt(10);
     }
   }
 
@@ -140,6 +134,7 @@ public class TestRegionObserverStacking extends TestCase {
     return r;
   }
 
+  @Test
   public void testRegionObserverStacking() throws Exception {
     byte[] ROW = Bytes.toBytes("testRow");
     byte[] TABLE = Bytes.toBytes(this.getClass().getSimpleName());
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFirstKeyValueMatchingQualifiersFilter.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFirstKeyValueMatchingQualifiersFilter.java
index 95dde36..bf80a62 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFirstKeyValueMatchingQualifiersFilter.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFirstKeyValueMatchingQualifiersFilter.java
@@ -17,9 +17,10 @@
  */
 package org.apache.hadoop.hbase.filter;
 
+import static org.junit.Assert.assertTrue;
+
 import java.util.Set;
 import java.util.TreeSet;
-import junit.framework.TestCase;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.testclassification.FilterTests;
@@ -30,7 +31,7 @@ import org.junit.experimental.categories.Category;
 
 @SuppressWarnings("deprecation")
 @Category({FilterTests.class, SmallTests.class})
-public class TestFirstKeyValueMatchingQualifiersFilter extends TestCase {
+public class TestFirstKeyValueMatchingQualifiersFilter {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
@@ -46,8 +47,6 @@ public class TestFirstKeyValueMatchingQualifiersFilter extends TestCase {
   /**
    * Test the functionality of
    * {@link FirstKeyValueMatchingQualifiersFilter#filterCell(org.apache.hadoop.hbase.Cell)}
-   *
-   * @throws Exception
    */
   public void testFirstKeyMatchingQualifierFilter() throws Exception {
     Set<byte[]> quals = new TreeSet<>(Bytes.BYTES_COMPARATOR);
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestImmutableBytesWritable.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestImmutableBytesWritable.java
index ee0e13f..3ab6c82 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestImmutableBytesWritable.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestImmutableBytesWritable.java
@@ -17,24 +17,29 @@
  */
 package org.apache.hadoop.hbase.io;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
-import junit.framework.TestCase;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.IOTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category({IOTests.class, SmallTests.class})
-public class TestImmutableBytesWritable extends TestCase {
+@Category({ IOTests.class, SmallTests.class })
+public class TestImmutableBytesWritable {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestImmutableBytesWritable.class);
 
+  @Test
   public void testHash() throws Exception {
     assertEquals(
       new ImmutableBytesWritable(Bytes.toBytes("xxabc"), 2, 3).hashCode(),
@@ -47,6 +52,7 @@ public class TestImmutableBytesWritable extends TestCase {
       new ImmutableBytesWritable(Bytes.toBytes("xxabc"), 2, 2).hashCode());
   }
 
+  @Test
   public void testSpecificCompare() {
     ImmutableBytesWritable ibw1 = new ImmutableBytesWritable(new byte[]{0x0f});
     ImmutableBytesWritable ibw2 = new ImmutableBytesWritable(new byte[]{0x00, 0x00});
@@ -54,6 +60,7 @@ public class TestImmutableBytesWritable extends TestCase {
     assertFalse("ibw1 < ibw2", c.compare( ibw1, ibw2 ) < 0 );
   }
 
+  @Test
   public void testComparison() throws Exception {
     runTests("aa", "b", -1);
     runTests("aa", "aa", 0);
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCachedBlockQueue.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCachedBlockQueue.java
index b81972e..91bc32c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCachedBlockQueue.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCachedBlockQueue.java
@@ -17,23 +17,25 @@
  */
 package org.apache.hadoop.hbase.io.hfile;
 
+import static org.junit.Assert.assertEquals;
+
 import java.nio.ByteBuffer;
-import junit.framework.TestCase;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.IOTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category({IOTests.class, SmallTests.class})
-public class TestCachedBlockQueue extends TestCase {
+@Category({ IOTests.class, SmallTests.class })
+public class TestCachedBlockQueue {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestCachedBlockQueue.class);
 
+  @Test
   public void testQueue() throws Exception {
-
     CachedBlock cb1 = new CachedBlock(1000, "cb1", 1);
     CachedBlock cb2 = new CachedBlock(1500, "cb2", 2);
     CachedBlock cb3 = new CachedBlock(1000, "cb3", 3);
@@ -70,8 +72,8 @@ public class TestCachedBlockQueue extends TestCase {
     }
   }
 
+  @Test
   public void testQueueSmallBlockEdgeCase() throws Exception {
-
     CachedBlock cb1 = new CachedBlock(1000, "cb1", 1);
     CachedBlock cb2 = new CachedBlock(1500, "cb2", 2);
     CachedBlock cb3 = new CachedBlock(1000, "cb3", 3);
@@ -115,39 +117,35 @@ public class TestCachedBlockQueue extends TestCase {
     }
   }
 
-  private static class CachedBlock extends org.apache.hadoop.hbase.io.hfile.LruCachedBlock
-  {
+  private static class CachedBlock extends org.apache.hadoop.hbase.io.hfile.LruCachedBlock {
     public CachedBlock(final long heapSize, String name, long accessTime) {
-      super(new BlockCacheKey(name, 0),
-          new Cacheable() {
-            @Override
-            public long heapSize() {
-              return ((int)(heapSize - CachedBlock.PER_BLOCK_OVERHEAD));
-            }
-
-            @Override
-            public int getSerializedLength() {
-              return 0;
-            }
-
-            @Override
-            public void serialize(ByteBuffer destination, boolean includeNextBlockMetadata) {
-            }
-
-            @Override
-            public CacheableDeserializer<Cacheable> getDeserializer() {
-              // TODO Auto-generated method stub
-              return null;
-            }
-
-            @Override
-            public BlockType getBlockType() {
-              return BlockType.DATA;
-            }
-
-          }, accessTime, false);
+      super(new BlockCacheKey(name, 0), new Cacheable() {
+        @Override
+        public long heapSize() {
+          return ((int) (heapSize - CachedBlock.PER_BLOCK_OVERHEAD));
+        }
+
+        @Override
+        public int getSerializedLength() {
+          return 0;
+        }
+
+        @Override
+        public void serialize(ByteBuffer destination, boolean includeNextBlockMetadata) {
+        }
+
+        @Override
+        public CacheableDeserializer<Cacheable> getDeserializer() {
+          return null;
+        }
+
+        @Override
+        public BlockType getBlockType() {
+          return BlockType.DATA;
+        }
+
+      }, accessTime, false);
     }
   }
-
 }
 
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java
index 51fa925..3026cd5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Random;
 import java.util.StringTokenizer;
-import junit.framework.TestCase;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
@@ -36,7 +35,10 @@ import org.apache.hadoop.hbase.testclassification.IOTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.util.RandomDistribution;
 import org.apache.hadoop.io.BytesWritable;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -58,8 +60,8 @@ import org.apache.hbase.thirdparty.org.apache.commons.cli.ParseException;
  * Remove after tfile is committed and use the tfile version of this class
  * instead.</p>
  */
-@Category({IOTests.class, SmallTests.class})
-public class TestHFileSeek extends TestCase {
+@Category({ IOTests.class, SmallTests.class })
+public class TestHFileSeek {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
@@ -79,7 +81,7 @@ public class TestHFileSeek extends TestCase {
 
   private static final Logger LOG = LoggerFactory.getLogger(TestHFileSeek.class);
 
-  @Override
+  @Before
   public void setUp() throws IOException {
     if (options == null) {
       options = new MyOptions(new String[0]);
@@ -111,7 +113,7 @@ public class TestHFileSeek extends TestCase {
             options.dictSize);
   }
 
-  @Override
+  @After
   public void tearDown() {
     try {
       fs.close();
@@ -216,6 +218,7 @@ public class TestHFileSeek extends TestCase {
 
   }
 
+  @Test
   public void testSeeks() throws IOException {
     if (options.doCreate()) {
       createTFile();
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellSkipListSet.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellSkipListSet.java
index c2e2ca1..2272368 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellSkipListSet.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellSkipListSet.java
@@ -17,9 +17,12 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Iterator;
 import java.util.SortedSet;
-import junit.framework.TestCase;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellComparatorImpl;
 import org.apache.hadoop.hbase.CellUtil;
@@ -28,11 +31,15 @@ import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Before;
 import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
 
-@Category({RegionServerTests.class, SmallTests.class})
-public class TestCellSkipListSet extends TestCase {
+@Category({ RegionServerTests.class, SmallTests.class })
+public class TestCellSkipListSet {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
@@ -41,14 +48,17 @@ public class TestCellSkipListSet extends TestCase {
   private final CellSet csls =
     new CellSet(CellComparatorImpl.COMPARATOR);
 
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();
+  @Rule
+  public TestName name = new TestName();
+
+  @Before
+  public void setUp() throws Exception {
     this.csls.clear();
   }
 
+  @Test
   public void testAdd() throws Exception {
-    byte[] bytes = Bytes.toBytes(getName());
+    byte[] bytes = Bytes.toBytes(name.getMethodName());
     KeyValue kv = new KeyValue(bytes, bytes, bytes, bytes);
     this.csls.add(kv);
     assertTrue(this.csls.contains(kv));
@@ -69,8 +79,9 @@ public class TestCellSkipListSet extends TestCase {
     assertFalse(Bytes.equals(CellUtil.cloneValue(overwrite), CellUtil.cloneValue(kv)));
   }
 
+  @Test
   public void testIterator() throws Exception {
-    byte [] bytes = Bytes.toBytes(getName());
+    byte [] bytes = Bytes.toBytes(name.getMethodName());
     byte [] value1 = Bytes.toBytes("1");
     byte [] value2 = Bytes.toBytes("2");
     final int total = 3;
@@ -104,8 +115,9 @@ public class TestCellSkipListSet extends TestCase {
     assertEquals(total, count);
   }
 
+  @Test
   public void testDescendingIterator() throws Exception {
-    byte [] bytes = Bytes.toBytes(getName());
+    byte [] bytes = Bytes.toBytes(name.getMethodName());
     byte [] value1 = Bytes.toBytes("1");
     byte [] value2 = Bytes.toBytes("2");
     final int total = 3;
@@ -141,8 +153,9 @@ public class TestCellSkipListSet extends TestCase {
     assertEquals(total, count);
   }
 
+  @Test
   public void testHeadTail() throws Exception {
-    byte [] bytes = Bytes.toBytes(getName());
+    byte [] bytes = Bytes.toBytes(name.getMethodName());
     byte [] value1 = Bytes.toBytes("1");
     byte [] value2 = Bytes.toBytes("2");
     final int total = 3;
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeyValueScanFixture.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeyValueScanFixture.java
index da46ef5..4f8ee55 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeyValueScanFixture.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeyValueScanFixture.java
@@ -17,8 +17,10 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.IOException;
-import junit.framework.TestCase;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellComparator;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -29,16 +31,17 @@ import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category({RegionServerTests.class, SmallTests.class})
-public class TestKeyValueScanFixture extends TestCase {
+@Category({ RegionServerTests.class, SmallTests.class })
+public class TestKeyValueScanFixture {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestKeyValueScanFixture.class);
 
-
+  @Test
   public void testKeyValueScanFixture() throws IOException {
     KeyValue kvs[] = new KeyValue[]{
         KeyValueTestUtil.create("RowA", "family", "qf1",
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBloomFilterChunk.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBloomFilterChunk.java
index 99754df..92378c7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBloomFilterChunk.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBloomFilterChunk.java
@@ -17,24 +17,29 @@
  */
 package org.apache.hadoop.hbase.util;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
 import java.nio.ByteBuffer;
-import junit.framework.TestCase;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.nio.MultiByteBuff;
 import org.apache.hadoop.hbase.testclassification.MiscTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category({MiscTests.class, SmallTests.class})
-public class TestBloomFilterChunk extends TestCase {
+public class TestBloomFilterChunk {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestBloomFilterChunk.class);
 
+  @Test
   public void testBasicBloom() throws Exception {
     BloomFilterChunk bf1 = new BloomFilterChunk(1000, (float)0.01, Hash.MURMUR_HASH, 0);
     BloomFilterChunk bf2 = new BloomFilterChunk(1000, (float)0.01, Hash.MURMUR_HASH, 0);
@@ -94,6 +99,7 @@ public class TestBloomFilterChunk extends TestCase {
     assertTrue(bOut.size() - bf1.byteSize < 10); //... allow small padding
   }
 
+  @Test
   public void testBloomFold() throws Exception {
     // test: foldFactor < log(max/actual)
     BloomFilterChunk b = new BloomFilterChunk(1003, (float) 0.01,
@@ -123,6 +129,7 @@ public class TestBloomFilterChunk extends TestCase {
     // test: foldFactor > log(max/actual)
   }
 
+  @Test
   public void testBloomPerf() throws Exception {
     // add
     float err = (float)0.01;
@@ -166,6 +173,7 @@ public class TestBloomFilterChunk extends TestCase {
     // test: foldFactor > log(max/actual)
   }
 
+  @Test
   public void testSizing() {
     int bitSize = 8 * 128 * 1024; // 128 KB
     double errorRate = 0.025; // target false positive rate
@@ -183,11 +191,10 @@ public class TestBloomFilterChunk extends TestCase {
     assertTrue(Math.abs(bitSize2 - bitSize) * 1.0 / bitSize < 1e-5);
   }
 
+  @Test
   public void testFoldableByteSize() {
     assertEquals(128, BloomFilterUtil.computeFoldableByteSize(1000, 5));
     assertEquals(640, BloomFilterUtil.computeFoldableByteSize(5001, 4));
   }
-
-
 }
 
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestConnectionCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestConnectionCache.java
index bb74b29..e6d7282 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestConnectionCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestConnectionCache.java
@@ -17,35 +17,47 @@
  */
 package org.apache.hadoop.hbase.util;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.security.UserProvider;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.testclassification.MiscTests;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category({MiscTests.class, MediumTests.class})
-public class TestConnectionCache extends TestCase {
+@Category({ MiscTests.class, MediumTests.class })
+public class TestConnectionCache {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
-      HBaseClassTestRule.forClass(TestConnectionCache.class);
+    HBaseClassTestRule.forClass(TestConnectionCache.class);
 
   private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
 
+  @BeforeClass
+  public static void setUp() throws Exception {
+    UTIL.startMiniCluster();
+  }
+
+  @AfterClass
+  public static void tearDown() throws IOException {
+    UTIL.shutdownMiniCluster();
+  }
+
   /**
    * test for ConnectionCache cleaning expired Connection
    */
   @Test
   public void testConnectionChore() throws Exception {
-    UTIL.startMiniCluster();
-
-    //1s for clean interval & 5s for maxIdleTime
+    // 1s for clean interval & 5s for maxIdleTime
     ConnectionCache cache = new ConnectionCache(UTIL.getConfiguration(),
-        UserProvider.instantiate(UTIL.getConfiguration()), 1000, 5000);
+      UserProvider.instantiate(UTIL.getConfiguration()), 1000, 5000);
     ConnectionCache.ConnectionInfo info = cache.getCurrentConnection();
 
     assertEquals(false, info.connection.isClosed());
@@ -53,8 +65,5 @@ public class TestConnectionCache extends TestCase {
     Thread.sleep(7000);
 
     assertEquals(true, info.connection.isClosed());
-    UTIL.shutdownMiniCluster();
   }
-
 }
-
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRootPath.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRootPath.java
index 18c9d42..226e0b5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRootPath.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRootPath.java
@@ -17,14 +17,16 @@
  */
 package org.apache.hadoop.hbase.util;
 
+import static org.junit.Assert.fail;
+
 import java.io.IOException;
-import junit.framework.TestCase;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.log.HBaseMarkers;
 import org.apache.hadoop.hbase.testclassification.MiscTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,7 +35,7 @@ import org.slf4j.LoggerFactory;
  * Test requirement that root directory must be a URI
  */
 @Category({MiscTests.class, SmallTests.class})
-public class TestRootPath extends TestCase {
+public class TestRootPath {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
@@ -42,6 +44,7 @@ public class TestRootPath extends TestCase {
   private static final Logger LOG = LoggerFactory.getLogger(TestRootPath.class);
 
   /** The test */
+  @Test
   public void testRootPath() {
     try {
       // Try good path
diff --git a/pom.xml b/pom.xml
index a09c39e..2b908b8 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1211,6 +1211,14 @@
                     <bannedImport>com.fasterxml.jackson.jaxrs.**</bannedImport>
                   </bannedImports>
                 </restrictImports>
+                <restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
+                  <includeTestCode>true</includeTestCode>
+                  <commentLineBufferSize>512</commentLineBufferSize>
+                  <reason>Use junit4 instead</reason>
+                  <bannedImports>
+                    <bannedImport>junit.framework.**</bannedImport>
+                  </bannedImports>
+                </restrictImports>
               </rules>
             </configuration>
           </execution>