Skip to content

Commit

Permalink
possibly fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
J3fftw1 committed Nov 20, 2023
1 parent bcf2eed commit 2f1f414
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;
Expand Down Expand Up @@ -67,6 +68,9 @@ public void runTests(@Nonnull String packageName) {
E2ETest annotation = method.getAnnotation(E2ETest.class);
String description = annotation.description();
boolean threadSafe = annotation.threadSafe();

CountDownLatch latch = new CountDownLatch(1);

// Invoke
try {
testsRan++;
Expand All @@ -79,15 +83,16 @@ public void runTests(@Nonnull String packageName) {
Bukkit.getScheduler().runTask(E2ETester.getInstance(), () -> {
try {
method.invoke(instance);
} catch (TestFailException e) {
throw e;
latch.countDown();
} catch (IllegalAccessException | InvocationTargetException e) {
latch.countDown();
if (e.getCause() instanceof TestFailException) {
throw (TestFailException) e.getCause();
}
throw new RuntimeException(e);
}
});
latch.await();
}

testsPassed++;
Expand Down

0 comments on commit 2f1f414

Please sign in to comment.