File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed
module/spring-boot-liquibase
src/test/java/org/springframework/boot/liquibase Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -56,3 +56,11 @@ dependencies {
56
56
testRuntimeOnly(" ch.qos.logback:logback-classic" )
57
57
testRuntimeOnly(" org.postgresql:postgresql" )
58
58
}
59
+
60
+ tasks. named(" compileTestJava" ) {
61
+ options. nullability. checking = " tests"
62
+ }
63
+
64
+ tasks. named(" compileDockerTestJava" ) {
65
+ options. nullability. checking = " tests"
66
+ }
Original file line number Diff line number Diff line change 20
20
21
21
import com .zaxxer .hikari .HikariDataSource ;
22
22
import liquibase .integration .spring .SpringLiquibase ;
23
+ import org .jspecify .annotations .Nullable ;
23
24
import org .junit .jupiter .api .Test ;
24
25
25
26
import org .springframework .beans .factory .BeanCreationException ;
@@ -40,20 +41,21 @@ class LiquibaseChangelogMissingFailureAnalyzerTests {
40
41
@ Test
41
42
void changelogParseExceptionDueToChangelogNotPresent () {
42
43
FailureAnalysis analysis = performAnalysis ();
44
+ assertThat (analysis ).isNotNull ();
43
45
assertThat (analysis .getDescription ())
44
46
.isEqualTo ("Liquibase failed to start because no changelog could be found at '"
45
47
+ "classpath:/db/changelog/db.changelog-master.yaml'." );
46
48
assertThat (analysis .getAction ())
47
49
.isEqualTo ("Make sure a Liquibase changelog is present at the configured path." );
48
50
}
49
51
50
- private FailureAnalysis performAnalysis () {
52
+ private @ Nullable FailureAnalysis performAnalysis () {
51
53
BeanCreationException failure = createFailure ();
52
54
assertThat (failure ).isNotNull ();
53
55
return new LiquibaseChangelogMissingFailureAnalyzer ().analyze (failure );
54
56
}
55
57
56
- private BeanCreationException createFailure () {
58
+ private @ Nullable BeanCreationException createFailure () {
57
59
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext (
58
60
LiquibaseConfiguration .class )) {
59
61
return null ;
Original file line number Diff line number Diff line change 25
25
import java .nio .file .Files ;
26
26
import java .nio .file .Path ;
27
27
import java .sql .Connection ;
28
+ import java .sql .Driver ;
28
29
import java .sql .SQLException ;
29
30
import java .util .Map ;
30
31
import java .util .UUID ;
@@ -334,7 +335,9 @@ void overrideDataSource() {
334
335
.run (assertLiquibase ((liquibase ) -> {
335
336
SimpleDriverDataSource dataSource = (SimpleDriverDataSource ) liquibase .getDataSource ();
336
337
assertThat (dataSource .getUrl ()).isEqualTo (jdbcUrl );
337
- assertThat (dataSource .getDriver ().getClass ().getName ()).isEqualTo ("org.h2.Driver" );
338
+ Driver driver = dataSource .getDriver ();
339
+ assertThat (driver ).isNotNull ();
340
+ assertThat (driver .getClass ().getName ()).isEqualTo ("org.h2.Driver" );
338
341
}));
339
342
}
340
343
@@ -349,7 +352,9 @@ void overrideDataSourceAndDriverClassName() {
349
352
.run (assertLiquibase ((liquibase ) -> {
350
353
SimpleDriverDataSource dataSource = (SimpleDriverDataSource ) liquibase .getDataSource ();
351
354
assertThat (dataSource .getUrl ()).isEqualTo (jdbcUrl );
352
- assertThat (dataSource .getDriver ().getClass ().getName ()).isEqualTo (driverClassName );
355
+ Driver driver = dataSource .getDriver ();
356
+ assertThat (driver ).isNotNull ();
357
+ assertThat (driver .getClass ().getName ()).isEqualTo (driverClassName );
353
358
}));
354
359
}
355
360
You can’t perform that action at this time.
0 commit comments