Skip to content

Commit b168e9d

Browse files
Pass unwrapped throwable to fail() so AssertionError cause is RecipeRunException
RewriteTest.defaultExecutionContext was passing the outer RecipeError to fail(), which made the resulting AssertionError's cause RecipeError instead of the underlying RecipeRunException. This regressed RepeatTest.repeatValidatesCursorIsPassed, which asserts that the cause is a RecipeRunException.
1 parent 8b3259c commit b168e9d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,9 @@ default ExecutionContext defaultExecutionContext(SourceSpec<?>[] sourceSpecs) {
706706
InMemoryExecutionContext ctx = new InMemoryExecutionContext(t -> {
707707
Throwable underlying = t instanceof RecipeError ? t.getCause() : t;
708708
if (underlying instanceof RecipeRunException) {
709-
fail("Failed to run recipe at " + ((RecipeRunException) underlying).getCursor(), t);
709+
fail("Failed to run recipe at " + ((RecipeRunException) underlying).getCursor(), underlying);
710710
}
711-
fail("Failed to parse sources or run recipe", t);
711+
fail("Failed to parse sources or run recipe", underlying);
712712
});
713713
for (Consumer<ExecutionContext> customizer : defaultExecutionContextCustomizers.values()) {
714714
customizer.accept(ctx);

0 commit comments

Comments
 (0)