Add nullability annotations to tests in module/spring-boot-jooq
See gh-47263
This commit is contained in:
parent
49c7546662
commit
1f293cc653
|
@ -43,3 +43,7 @@ dependencies {
|
|||
testRuntimeOnly("org.glassfish.jaxb:jaxb-runtime")
|
||||
testRuntimeOnly("org.hsqldb:hsqldb")
|
||||
}
|
||||
|
||||
tasks.named("compileTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ class DefaultExceptionTranslatorExecuteListenerTests {
|
|||
private final ExceptionTranslatorExecuteListener listener = new DefaultExceptionTranslatorExecuteListener();
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("NullAway") // Test null check
|
||||
void createWhenTranslatorFactoryIsNullThrowsException() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new DefaultExceptionTranslatorExecuteListener(
|
||||
|
@ -74,7 +75,7 @@ class DefaultExceptionTranslatorExecuteListenerTests {
|
|||
|
||||
@Test
|
||||
void exceptionWhenHasCustomTranslatorFactory() {
|
||||
SQLExceptionTranslator translator = BadSqlGrammarException::new;
|
||||
SQLExceptionTranslator translator = (task, sql, ex) -> new BadSqlGrammarException(task, "sql", ex);
|
||||
ExceptionTranslatorExecuteListener listener = new DefaultExceptionTranslatorExecuteListener(
|
||||
(context) -> translator);
|
||||
SQLException sqlException = sqlException(123);
|
||||
|
|
|
@ -361,7 +361,7 @@ class JooqAutoConfigurationTests {
|
|||
|
||||
@Override
|
||||
public ExecuteListener provide() {
|
||||
return null;
|
||||
return mock(ExecuteListener.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.sql.SQLException;
|
|||
import javax.sql.DataSource;
|
||||
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -44,7 +45,7 @@ import static org.mockito.Mockito.never;
|
|||
*/
|
||||
class JooqPropertiesTests {
|
||||
|
||||
private AnnotationConfigApplicationContext context;
|
||||
private @Nullable AnnotationConfigApplicationContext context;
|
||||
|
||||
@AfterEach
|
||||
void close() {
|
||||
|
|
Loading…
Reference in New Issue