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