Skip to content

Commit

Permalink
Make the test unit finder thread-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed May 9, 2023
1 parent b08c063 commit 73391eb
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 73391eb

Please sign in to comment.