Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
luciano-fiandesio committed Dec 3, 2024
1 parent 40dc096 commit 98f6f2f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
Expand Down Expand Up @@ -88,6 +89,7 @@
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import org.springframework.jdbc.BadSqlGrammarException;
import org.springframework.jdbc.UncategorizedSQLException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;

Expand Down Expand Up @@ -379,7 +381,10 @@ void testBadGrammarExceptionWithMultipleQueries() {
// Given
mockEmptyRowSet();
EventQueryParams params = createRequestParamsWithMultipleQueries();
when(jdbcTemplate.queryForRowSet(anyString())).thenThrow(BadSqlGrammarException.class);
SQLException sqlException = new SQLException("Some exception", "HY000");
BadSqlGrammarException badSqlGrammarException =
new BadSqlGrammarException("task", "select * from nothing", sqlException);
when(jdbcTemplate.queryForRowSet(anyString())).thenThrow(badSqlGrammarException);

// Then
assertDoesNotThrow(() -> subject.getEnrollments(params, new ListGrid(), 10000));
Expand Down

0 comments on commit 98f6f2f

Please sign in to comment.