Skip to content
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

[SUREFIRE-2172] StringUtils: yet more of them #768

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[SUREFIRE-2172] StringUtils: yet more of them
FredrikAnderson committed Aug 9, 2024
commit e564d1759ce845ed817899c2705ae03bb5852da2
Original file line number Diff line number Diff line change
@@ -21,8 +21,6 @@
import java.io.PrintWriter;
import java.io.StringWriter;

import org.apache.maven.surefire.api.util.internal.StringUtils;

import static org.apache.maven.surefire.shared.utils.StringUtils.isNotEmpty;

/**
@@ -54,7 +52,7 @@ public String writeTraceToString() {
if (isMultiLineExceptionMessage(t)) {
// SUREFIRE-986
String exc = t.getClass().getName() + ": ";
if (StringUtils.startsWith(builder, exc)) {
if (builder.toString().startsWith(exc)) {
builder.insert(exc.length(), '\n');
}
}
@@ -105,7 +103,7 @@ public String writeTrimmedTraceToString() {

String marker = "at " + testClass + "." + testMethod;

String[] lines = StringUtils.split(text, "\n");
String[] lines = text.split("\n");
int lastLine = lines.length - 1;
int causedByLine = -1;
// skip first
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
*/
package org.apache.maven.surefire.its;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.surefire.its.fixture.OutputValidator;
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
@@ -46,11 +45,11 @@ public void testClassesParallel() {
}

private void checkReports(OutputValidator validator) {
String report = StringUtils.trimToNull(validator
String report = trimToNull(validator
.getSurefireReportsFile("junit47ConsoleOutput.Test1-output.txt")
.readFileToString());
assertNotNull(report);
String report2 = StringUtils.trimToNull(validator
String report2 = trimToNull(validator
.getSurefireReportsFile("junit47ConsoleOutput.Test2-output.txt")
.readFileToString());
assertNotNull(report2);
@@ -59,6 +58,11 @@ private void checkReports(OutputValidator validator) {
.exists());
}

private String trimToNull(String string) {
String str = string.trim();
return str.isEmpty() ? null : str;
}

private SurefireLauncher unpack() {
return unpack("/junit47-redirect-output");
}