mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Add nullability annotations to tests in module/spring-boot-jooq
See gh-47263
This commit is contained in:
@@ -43,3 +43,7 @@ dependencies {
|
||||
testRuntimeOnly("org.glassfish.jaxb:jaxb-runtime")
|
||||
testRuntimeOnly("org.hsqldb:hsqldb")
|
||||
}
|
||||
|
||||
tasks.named("compileTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
||||
+2
-1
@@ -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);
|
||||
|
||||
+1
-1
@@ -361,7 +361,7 @@ class JooqAutoConfigurationTests {
|
||||
|
||||
@Override
|
||||
public ExecuteListener provide() {
|
||||
return null;
|
||||
return mock(ExecuteListener.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user