Skip to content

[DISCUSS] [JDK17] Upgrade JUnit / JavaDoc from 4 to 5. #7337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.XMLUtils;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -85,7 +85,7 @@ protected void readTestConfigFile() {
testConfigFile, e);
success = false;
}
assertTrue("Error reading test config file", success);
assertTrue(success, "Error reading test config file");
}
}

Expand Down Expand Up @@ -262,9 +262,9 @@ private void displayResults() {
LOG.info("NONE");
}

assertTrue("One of the tests failed. " +
assertTrue(overallResults, "One of the tests failed. " +
"See the Detailed results to identify " +
"the command that failed", overallResults);
"the command that failed");

}

Expand Down Expand Up @@ -310,8 +310,8 @@ private boolean compareTextExitCode(ComparatorData compdata,
*********************************/

public void testAll() {
assertTrue("Number of tests has to be greater then zero",
testsFromConfigFile.size() > 0);
assertTrue(
testsFromConfigFile.size() > 0, "Number of tests has to be greater then zero");
LOG.info("TestAll");
// Run the tests defined in the testConf.xml config file.
for (int index = 0; index < testsFromConfigFile.size(); index++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@

import org.apache.hadoop.cli.util.CLICommand;
import org.apache.hadoop.cli.util.CommandExecutor;
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;

/**
* Tests for the Command Line Interface (CLI)
*/
public class TestCLI extends CLITestHelper {
@Before
@BeforeEach
@Override
public void setUp() throws Exception {
super.setUp();
}

@After
@AfterEach
@Override
public void tearDown() throws Exception {
super.tearDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
import org.apache.hadoop.http.HttpServer2;
import org.apache.hadoop.util.XMLUtils;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

/**
* Basic test case that the ConfServlet can write configuration
Expand All @@ -64,7 +64,7 @@ public class TestConfServlet {
new HashMap<String, String>();
private static final Map<String, String> MASK_PROPERTIES = new HashMap<>();

@BeforeClass
@BeforeAll
public static void initTestProperties() {
TEST_PROPERTIES.put("test.key1", "value1");
TEST_PROPERTIES.put("test.key2", "value2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

package org.apache.hadoop.conf;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -75,9 +75,9 @@ private void testRedact(Configuration conf) throws Exception {
);
for (String key : sensitiveKeys) {
processedText = redactor.redact(key, ORIGINAL_VALUE);
Assert.assertEquals(
"Config parameter wasn't redacted and should be: " + key,
REDACTED_TEXT, processedText);
Assertions.assertEquals(

REDACTED_TEXT, processedText, "Config parameter wasn't redacted and should be: " + key);
}

List<String> normalKeys = Arrays.asList(
Expand All @@ -90,9 +90,9 @@ private void testRedact(Configuration conf) throws Exception {
);
for (String key : normalKeys) {
processedText = redactor.redact(key, ORIGINAL_VALUE);
Assert.assertEquals(
"Config parameter was redacted and shouldn't be: " + key,
ORIGINAL_VALUE, processedText);
Assertions.assertEquals(

ORIGINAL_VALUE, processedText, "Config parameter was redacted and shouldn't be: " + key);
}
}
}
Loading