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
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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)) {
FredrikAnderson marked this conversation as resolved.
Show resolved Hide resolved
builder.insert(exc.length(), '\n');
}
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
FredrikAnderson marked this conversation as resolved.
Show resolved Hide resolved
.getSurefireReportsFile("junit47ConsoleOutput.Test2-output.txt")
.readFileToString());
assertNotNull(report2);
Expand All @@ -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");
}
Expand Down