You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by aa...@apache.org on 2022/11/21 05:36:45 UTC
[hadoop] branch trunk updated: MAPREDUCE-7422. Upgrade Junit 4 to 5 in hadoop-mapreduce-examples (#5029)
This is an automated email from the ASF dual-hosted git repository.
aajisaka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new dcde4145705 MAPREDUCE-7422. Upgrade Junit 4 to 5 in hadoop-mapreduce-examples (#5029)
dcde4145705 is described below
commit dcde414570510ff538e078a1e09a27dfff2b38b2
Author: Ashutosh Gupta <as...@st.niituniversity.in>
AuthorDate: Mon Nov 21 05:36:35 2022 +0000
MAPREDUCE-7422. Upgrade Junit 4 to 5 in hadoop-mapreduce-examples (#5029)
Co-authored-by: Ashutosh Gupta <as...@amazon.com>
Signed-off-by: Akira Ajisaka <aa...@apache.org>
---
.../hadoop-mapreduce-examples/pom.xml | 75 +++++++++++++---------
.../hadoop/examples/TestAggregateWordCount.java | 18 ++++--
.../hadoop/examples/TestBaileyBorweinPlouffe.java | 25 ++++----
.../org/apache/hadoop/examples/TestWordStats.java | 23 ++++---
.../hadoop/examples/pi/math/TestLongLong.java | 19 +++---
.../hadoop/examples/pi/math/TestModular.java | 55 +++++++---------
.../hadoop/examples/pi/math/TestSummation.java | 27 ++++----
.../hadoop/examples/terasort/TestTeraSort.java | 22 ++++---
8 files changed, 145 insertions(+), 119 deletions(-)
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/pom.xml b/hadoop-mapreduce-project/hadoop-mapreduce-examples/pom.xml
index 16ce47579fe..e5426a08b3c 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/pom.xml
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/pom.xml
@@ -70,40 +70,40 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-hdfs</artifactId>
- <scope>test</scope>
- <type>test-jar</type>
- <exclusions>
- <exclusion>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-commons</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-yarn-server-tests</artifactId>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-mapreduce-client-app</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-mapreduce-client-app</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ <exclusions>
+ <exclusion>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-server-tests</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-mapreduce-client-app</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-mapreduce-client-app</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly2</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-hs</artifactId>
<scope>test</scope>
@@ -118,7 +118,7 @@
<groupId>org.apache.hadoop.thirdparty</groupId>
<artifactId>hadoop-shaded-guava</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -128,6 +128,21 @@
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-launcher</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestAggregateWordCount.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestAggregateWordCount.java
index 2bc909c0c36..9828b24d98f 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestAggregateWordCount.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestAggregateWordCount.java
@@ -21,8 +21,9 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.fs.FSDataInputStream;
@@ -33,14 +34,19 @@ import org.apache.hadoop.mapred.HadoopTestCase;
import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.util.ExitUtil.ExitException;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestAggregateWordCount extends HadoopTestCase {
public TestAggregateWordCount() throws IOException {
super(LOCAL_MR, LOCAL_FS, 1, 1);
}
- @After
+ @BeforeEach
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterEach
public void tearDown() throws Exception {
FileSystem fs = getFileSystem();
if (fs != null) {
@@ -58,7 +64,7 @@ public class TestAggregateWordCount extends HadoopTestCase {
private static final Path OUTPUT_PATH = new Path(TEST_DIR, "outPath");
@Test
- public void testAggregateTestCount()
+ void testAggregateTestCount()
throws IOException, ClassNotFoundException, InterruptedException {
ExitUtil.disableSystemExit();
@@ -70,7 +76,7 @@ public class TestAggregateWordCount extends HadoopTestCase {
FileUtil.write(fs, file2, "Hello Hadoop");
String[] args =
- new String[] {INPUT_PATH.toString(), OUTPUT_PATH.toString(), "1",
+ new String[]{INPUT_PATH.toString(), OUTPUT_PATH.toString(), "1",
"textinputformat"};
// Run AggregateWordCount Job.
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestBaileyBorweinPlouffe.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestBaileyBorweinPlouffe.java
index 2df2df09117..ffec884795e 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestBaileyBorweinPlouffe.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestBaileyBorweinPlouffe.java
@@ -18,35 +18,36 @@
package org.apache.hadoop.examples;
import java.math.BigInteger;
-import org.junit.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/** Tests for BaileyBorweinPlouffe */
public class TestBaileyBorweinPlouffe {
@Test
- public void testMod() {
+ void testMod() {
final BigInteger TWO = BigInteger.ONE.add(BigInteger.ONE);
- for(long n = 3; n < 100; n++) {
+ for (long n = 3; n < 100; n++) {
for (long e = 1; e < 100; e++) {
final long r = TWO.modPow(
BigInteger.valueOf(e), BigInteger.valueOf(n)).longValue();
- Assert.assertEquals("e=" + e + ", n=" + n, r, BaileyBorweinPlouffe
- .mod(e, n));
+ assertEquals(r, BaileyBorweinPlouffe
+ .mod(e, n), "e=" + e + ", n=" + n);
}
}
}
@Test
- public void testHexDigit() {
+ void testHexDigit() {
final long[] answers = {0x43F6, 0xA308, 0x29B7, 0x49F1, 0x8AC8, 0x35EA};
long d = 1;
- for(int i = 0; i < answers.length; i++) {
- Assert.assertEquals("d=" + d, answers[i], BaileyBorweinPlouffe
- .hexDigits(d));
+ for (int i = 0; i < answers.length; i++) {
+ assertEquals(answers[i], BaileyBorweinPlouffe
+ .hexDigits(d), "d=" + d);
d *= 10;
}
- Assert.assertEquals(0x243FL, BaileyBorweinPlouffe.hexDigits(0));
- }
+ assertEquals(0x243FL, BaileyBorweinPlouffe.hexDigits(0));
+ }
}
\ No newline at end of file
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestWordStats.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestWordStats.java
index 3f0ffd63f6d..45aa4102bd1 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestWordStats.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/TestWordStats.java
@@ -17,8 +17,6 @@
*/
package org.apache.hadoop.examples;
-import static org.junit.Assert.assertEquals;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -31,9 +29,11 @@ import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestWordStats {
@@ -241,13 +241,14 @@ public class TestWordStats {
return dir.delete();
}
- @Before public void setup() throws Exception {
+ @BeforeEach public void setup() throws Exception {
deleteDir(new File(MEAN_OUTPUT));
deleteDir(new File(MEDIAN_OUTPUT));
deleteDir(new File(STDDEV_OUTPUT));
}
- @Test public void testGetTheMean() throws Exception {
+ @Test
+ void testGetTheMean() throws Exception {
String args[] = new String[2];
args[0] = INPUT;
args[1] = MEAN_OUTPUT;
@@ -261,7 +262,8 @@ public class TestWordStats {
assertEquals(mean, wr.read(INPUT), 0.0);
}
- @Test public void testGetTheMedian() throws Exception {
+ @Test
+ void testGetTheMedian() throws Exception {
String args[] = new String[2];
args[0] = INPUT;
args[1] = MEDIAN_OUTPUT;
@@ -275,7 +277,8 @@ public class TestWordStats {
assertEquals(median, wr.read(INPUT), 0.0);
}
- @Test public void testGetTheStandardDeviation() throws Exception {
+ @Test
+ void testGetTheStandardDeviation() throws Exception {
String args[] = new String[2];
args[0] = INPUT;
args[1] = STDDEV_OUTPUT;
@@ -289,7 +292,7 @@ public class TestWordStats {
assertEquals(stddev, wr.read(INPUT), 0.0);
}
- @AfterClass public static void cleanup() throws Exception {
+ @AfterAll public static void cleanup() throws Exception {
deleteDir(new File(MEAN_OUTPUT));
deleteDir(new File(MEDIAN_OUTPUT));
deleteDir(new File(STDDEV_OUTPUT));
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestLongLong.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestLongLong.java
index 232c53f4d47..318306cf9c3 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestLongLong.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestLongLong.java
@@ -19,8 +19,9 @@ package org.apache.hadoop.examples.pi.math;
import java.math.BigInteger;
import java.util.Random;
-import org.junit.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestLongLong {
@@ -39,12 +40,12 @@ public class TestLongLong {
"\na = %x\nb = %x\nll= " + ll + "\nbi= " + bi.toString(16) + "\n", a,
b);
//System.out.println(s);
- Assert.assertEquals(s, bi, ll.toBigInteger());
+ assertEquals(bi, ll.toBigInteger(), s);
}
@Test
- public void testMultiplication() {
- for(int i = 0; i < 100; i++) {
+ void testMultiplication() {
+ for (int i = 0; i < 100; i++) {
final long a = nextPositiveLong();
final long b = nextPositiveLong();
verifyMultiplication(a, b);
@@ -54,8 +55,8 @@ public class TestLongLong {
}
@Test
- public void testRightShift() {
- for(int i = 0; i < 1000; i++) {
+ void testRightShift() {
+ for (int i = 0; i < 1000; i++) {
final long a = nextPositiveLong();
final long b = nextPositiveLong();
verifyRightShift(a, b);
@@ -69,12 +70,12 @@ public class TestLongLong {
final String s = String.format(
"\na = %x\nb = %x\nll= " + ll + "\nbi= " + bi.toString(16) + "\n", a,
b);
- Assert.assertEquals(s, bi, ll.toBigInteger());
+ assertEquals(bi, ll.toBigInteger(), s);
for (int i = 0; i < LongLong.SIZE >> 1; i++) {
final long result = ll.shiftRight(i) & MASK;
final long expected = bi.shiftRight(i).longValue() & MASK;
- Assert.assertEquals(s, expected, result);
+ assertEquals(expected, result, s);
}
}
}
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestModular.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestModular.java
index a75ec29d1c9..96e70efc76b 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestModular.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestModular.java
@@ -21,8 +21,9 @@ import java.math.BigInteger;
import java.util.Random;
import org.apache.hadoop.examples.pi.Util.Timer;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestModular{
private static final Random RANDOM = new Random();
@@ -52,13 +53,13 @@ public class TestModular{
}
@Test
- public void testDiv() {
- for(long n = 2; n < 100; n++)
- for(long r = 1; r < n; r++) {
+ void testDiv() {
+ for (long n = 2; n < 100; n++)
+ for (long r = 1; r < n; r++) {
final long a = div(0, r, n);
- final long b = (long)((r*1.0/n) * (1L << DIV_VALID_BIT));
+ final long b = (long) ((r * 1.0 / n) * (1L << DIV_VALID_BIT));
final String s = String.format("r=%d, n=%d, a=%X, b=%X", r, n, a, b);
- Assert.assertEquals(s, b, a);
+ assertEquals(b, a, s);
}
}
@@ -151,9 +152,8 @@ public class TestModular{
final long answer = rn[i][j][1];
final long s = square_slow(r, n);
if (s != answer) {
- Assert.assertEquals(
- "r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s,
- answer, s);
+ assertEquals(
+ answer, s, "r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s);
}
}
}
@@ -168,9 +168,8 @@ public class TestModular{
final long answer = rn[i][j][1];
final long s = square(r, n, r2p64);
if (s != answer) {
- Assert.assertEquals(
- "r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s,
- answer, s);
+ assertEquals(
+ answer, s, "r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s);
}
}
}
@@ -185,9 +184,8 @@ public class TestModular{
final BigInteger R = BigInteger.valueOf(r);
final long s = R.multiply(R).mod(N).longValue();
if (s != answer) {
- Assert.assertEquals(
- "r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s,
- answer, s);
+ assertEquals(
+ answer, s, "r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s);
}
}
}
@@ -202,9 +200,8 @@ public class TestModular{
final BigInteger R = BigInteger.valueOf(r);
final long s = R.modPow(TWO, N).longValue();
if (s != answer) {
- Assert.assertEquals(
- "r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s,
- answer, s);
+ assertEquals(
+ answer, s, "r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s);
}
}
}
@@ -299,9 +296,8 @@ public class TestModular{
final long answer = en[i][j][1];
final long s = Modular.mod(e, n);
if (s != answer) {
- Assert.assertEquals(
- "e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s,
- answer, s);
+ assertEquals(
+ answer, s, "e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s);
}
}
}
@@ -316,9 +312,8 @@ public class TestModular{
final long answer = en[i][j][1];
final long s = m2.mod(e);
if (s != answer) {
- Assert.assertEquals(
- "e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s,
- answer, s);
+ assertEquals(
+ answer, s, "e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s);
}
}
}
@@ -332,9 +327,8 @@ public class TestModular{
final long answer = en[i][j][1];
final long s = m2.mod2(e);
if (s != answer) {
- Assert.assertEquals(
- "e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s,
- answer, s);
+ assertEquals(
+ answer, s, "e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s);
}
}
}
@@ -348,9 +342,8 @@ public class TestModular{
final long answer = en[i][j][1];
final long s = TWO.modPow(BigInteger.valueOf(e), N).longValue();
if (s != answer) {
- Assert.assertEquals(
- "e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s,
- answer, s);
+ assertEquals(
+ answer, s, "e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s);
}
}
}
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestSummation.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestSummation.java
index 2741962b329..92012ac4d95 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestSummation.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/pi/math/TestSummation.java
@@ -28,8 +28,9 @@ import org.apache.hadoop.examples.pi.Container;
import org.apache.hadoop.examples.pi.Util;
import org.apache.hadoop.examples.pi.Util.Timer;
import org.apache.hadoop.examples.pi.math.TestModular.Montgomery2;
-import org.junit.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestSummation {
static final Random RANDOM = new Random();
@@ -58,12 +59,12 @@ public class TestSummation {
final List<Summation> combined = Util.combine(a);
// Util.out.println("combined=" + combined);
- Assert.assertEquals(1, combined.size());
- Assert.assertEquals(sigma, combined.get(0));
+ assertEquals(1, combined.size());
+ assertEquals(sigma, combined.get(0));
}
@Test
- public void testSubtract() {
+ void testSubtract() {
final Summation sigma = newSummation(3, 10000, 20);
final int size = 10;
final List<Summation> parts = Arrays.asList(sigma.partition(size));
@@ -72,10 +73,10 @@ public class TestSummation {
runTestSubtract(sigma, new ArrayList<Summation>());
runTestSubtract(sigma, parts);
- for(int n = 1; n < size; n++) {
- for(int j = 0; j < 10; j++) {
+ for (int n = 1; n < size; n++) {
+ for (int j = 0; j < 10; j++) {
final List<Summation> diff = new ArrayList<Summation>(parts);
- for(int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
diff.remove(RANDOM.nextInt(diff.size()));
/// Collections.sort(diff);
runTestSubtract(sigma, diff);
@@ -132,16 +133,16 @@ public class TestSummation {
t.tick("sigma=" + sigma);
final double value = sigma.compute();
t.tick("compute=" + value);
- Assert.assertEquals(value, sigma.compute_modular(), DOUBLE_DELTA);
+ assertEquals(value, sigma.compute_modular(), DOUBLE_DELTA);
t.tick("compute_modular");
- Assert.assertEquals(value, sigma.compute_montgomery(), DOUBLE_DELTA);
+ assertEquals(value, sigma.compute_montgomery(), DOUBLE_DELTA);
t.tick("compute_montgomery");
- Assert.assertEquals(value, sigma.compute_montgomery2(), DOUBLE_DELTA);
+ assertEquals(value, sigma.compute_montgomery2(), DOUBLE_DELTA);
t.tick("compute_montgomery2");
- Assert.assertEquals(value, sigma.compute_modBigInteger(), DOUBLE_DELTA);
+ assertEquals(value, sigma.compute_modBigInteger(), DOUBLE_DELTA);
t.tick("compute_modBigInteger");
- Assert.assertEquals(value, sigma.compute_modPow(), DOUBLE_DELTA);
+ assertEquals(value, sigma.compute_modPow(), DOUBLE_DELTA);
t.tick("compute_modPow");
}
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/terasort/TestTeraSort.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/terasort/TestTeraSort.java
index 1bc9f2f56a2..ef1688c0929 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/terasort/TestTeraSort.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/test/java/org/apache/hadoop/examples/terasort/TestTeraSort.java
@@ -25,14 +25,15 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.FileAlreadyExistsException;
import org.apache.hadoop.mapred.HadoopTestCase;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
public class TestTeraSort extends HadoopTestCase {
private static final Logger LOG = LoggerFactory.getLogger(TestTeraSort.class);
@@ -42,7 +43,12 @@ public class TestTeraSort extends HadoopTestCase {
super(LOCAL_MR, LOCAL_FS, 1, 1);
}
- @After
+ @BeforeEach
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterEach
public void tearDown() throws Exception {
getFileSystem().delete(TEST_DIR, true);
super.tearDown();
@@ -85,7 +91,7 @@ public class TestTeraSort extends HadoopTestCase {
}
@Test
- public void testTeraSort() throws Exception {
+ void testTeraSort() throws Exception {
// Run TeraGen to generate input for 'terasort'
runTeraGen(createJobConf(), SORT_INPUT_PATH);
@@ -110,11 +116,11 @@ public class TestTeraSort extends HadoopTestCase {
// Run tera-validator to check if sort worked correctly
runTeraValidator(createJobConf(), SORT_OUTPUT_PATH,
- TERA_OUTPUT_PATH);
+ TERA_OUTPUT_PATH);
}
@Test
- public void testTeraSortWithLessThanTwoArgs() throws Exception {
+ void testTeraSortWithLessThanTwoArgs() throws Exception {
String[] args = new String[1];
assertThat(new TeraSort().run(args)).isEqualTo(2);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org