Skip to content

Commit

Permalink
Add missing test for SQLExceptionChainBuilderTest.addFirst
Browse files Browse the repository at this point in the history
  • Loading branch information
mrotteveel committed Feb 27, 2024
1 parent d3697c6 commit c68b555
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ void testBuilder_MultipleAppends() {
assertSame(root, resultException, "Expected root exception to be identical to returned exception");
checkExceptionChain(resultException, additionalExceptions);
}

/**
* Test for SQLExceptionChainBuilder with one append and one addFirst
*/
@Test
void testBuilder_OneAppendOneAddFirst() {
var initialRoot = new SQLException("initial root");
var finalRoot = new SQLException("final root");
var builder = new SQLExceptionChainBuilder();

builder.append(initialRoot).addFirst(finalRoot);

assertTrue(builder.hasException(), "SQLExceptionChainBuilder has a exception");
SQLException resultException = builder.getException();
assertSame(finalRoot, resultException, "Expected final root exception to be the returned exception");
checkExceptionChain(resultException, List.of(initialRoot));
}

/**
* Checks the exception chain returned from getNextException (root itself is not checked).
Expand Down

0 comments on commit c68b555

Please sign in to comment.