Skip to content

Commit

Permalink
[SUREFIRE-1345] - Rename to hasFlakes and make list immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Dec 17, 2023
1 parent 1e8696b commit b3faa7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.maven.plugins.surefire.report;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static org.apache.maven.shared.utils.StringUtils.isNotBlank;
Expand Down Expand Up @@ -168,7 +169,7 @@ public boolean hasSkipped() {
return hasSkipped;
}

public boolean hasFlake() {
public boolean hasFlakes() {
return !flakyErrors.isEmpty() || !flakyFailures.isEmpty();
}

Expand All @@ -177,15 +178,15 @@ public void addFlakyError(FlakyError flakyError) {
}

public List<FlakyError> getFlakyErrors() {
return flakyErrors;
return Collections.unmodifiableList(flakyErrors);
}

public void addFlakyFailure(FlakyFailure flakyFailure) {
flakyFailures.add(flakyFailure);
}

public List<FlakyFailure> getFlakyFailures() {
return flakyFailures;
return Collections.unmodifiableList(flakyFailures);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ public void shouldParseFlakes() throws Exception {
assertThat(tests.get(0).getTime(), is(0.034f));
assertThat(tests.get(0).getFullName(), is("org.acme.FlakyTest.testFlaky"));
assertThat(tests.get(0).hasError(), is(false));
assertThat(tests.get(0).hasFlake(), is(true));
assertThat(tests.get(0).hasFlakes(), is(true));

List<FlakyFailure> flakyFailures = tests.get(0).getFlakyFailures();
assertThat(flakyFailures.size(), is(3));
Expand Down Expand Up @@ -781,6 +781,6 @@ public void shouldParseFlakes() throws Exception {
assertThat(tests.get(1).getTime(), is(0.001f));
assertThat(tests.get(1).getFullName(), is("org.acme.FlakyTest.testStable"));
assertThat(tests.get(1).hasError(), is(false));
assertThat(tests.get(1).hasFlake(), is(false));
assertThat(tests.get(1).hasFlakes(), is(false));
}
}

0 comments on commit b3faa7e

Please sign in to comment.