Skip to content

Commit 02edc56

Browse files
committed
Repeat test in case of assertion error
1 parent c7bf8d9 commit 02edc56

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/test/java/com/rabbitmq/stream/impl/FilteringTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,20 @@ private void publish(
234234

235235
private static void repeatIfFailure(RunnableWithException test) throws Exception {
236236
int executionCount = 0;
237-
Exception lastException = null;
237+
Throwable lastException = null;
238238
while (executionCount < 5) {
239239
try {
240240
test.run();
241241
return;
242-
} catch (Exception e) {
242+
} catch (Exception | AssertionError e) {
243243
executionCount++;
244244
lastException = e;
245245
}
246246
}
247-
throw lastException;
247+
if (lastException instanceof Error) {
248+
throw new RuntimeException(lastException);
249+
} else {
250+
throw (Exception) lastException;
251+
}
248252
}
249253
}

0 commit comments

Comments
 (0)