Skip to content

Commit

Permalink
Merge pull request #90 from Vampire/make-test-unit-finder-thread-safe
Browse files Browse the repository at this point in the history
Make the test unit finder thread-safe
  • Loading branch information
hcoles authored May 15, 2023
2 parents b08c063 + 73391eb commit 0f30f27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/pitest/junit5/JUnit5TestUnitFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.List;

import static java.util.Collections.emptyList;
import static java.util.Collections.synchronizedList;
import static java.util.Collections.unmodifiableList;
import static java.util.stream.Collectors.toList;

Expand Down Expand Up @@ -95,15 +96,15 @@ public List<TestUnit> findTestUnits(Class<?> clazz, TestUnitExecutionListener ex
private class TestIdentifierListener implements TestExecutionListener {
private final Class<?> testClass;
private final TestUnitExecutionListener l;
private final List<TestIdentifier> identifiers = new ArrayList<>();
private final List<TestIdentifier> identifiers = synchronizedList(new ArrayList<>());

public TestIdentifierListener(Class<?> testClass, TestUnitExecutionListener l) {
this.testClass = testClass;
this.l = l;
}

List<TestIdentifier> getIdentifiers() {
return unmodifiableList(identifiers);
return unmodifiableList(new ArrayList<>(identifiers));
}

@Override
Expand Down

0 comments on commit 0f30f27

Please sign in to comment.