diff --git a/src/main/java/net/openhft/chronicle/testframework/internal/VanillaExceptionTracker.java b/src/main/java/net/openhft/chronicle/testframework/internal/VanillaExceptionTracker.java index 68423c14..0affffd6 100644 --- a/src/main/java/net/openhft/chronicle/testframework/internal/VanillaExceptionTracker.java +++ b/src/main/java/net/openhft/chronicle/testframework/internal/VanillaExceptionTracker.java @@ -99,10 +99,17 @@ public void checkExceptions() { LOGGER.debug("Ignored {}", ignoredException.getValue()); } - if (hasExceptions()) { + Set unexpectedExceptions = exceptions.keySet() + .stream().filter(ignorePredicate.negate()).collect(Collectors.toSet()); + + if (!unexpectedExceptions.isEmpty()) { dumpException(); - final String msg = exceptions.size() + " exceptions were detected: " + exceptions.keySet().stream().map(messageExtractor::apply).collect(Collectors.joining(", ")); + final String msg = + unexpectedExceptions.size() + " unexpected exceptions were detected: " + + unexpectedExceptions.stream() + .map(messageExtractor) + .collect(Collectors.joining(", ")); throw new AssertionError(msg); } resetRunnable.run();