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 {
5656 testRuntimeOnly(" ch.qos.logback:logback-classic" )
5757 testRuntimeOnly(" org.postgresql:postgresql" )
5858}
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 2020
2121import com .zaxxer .hikari .HikariDataSource ;
2222import liquibase .integration .spring .SpringLiquibase ;
23+ import org .jspecify .annotations .Nullable ;
2324import org .junit .jupiter .api .Test ;
2425
2526import org .springframework .beans .factory .BeanCreationException ;
@@ -40,20 +41,21 @@ class LiquibaseChangelogMissingFailureAnalyzerTests {
4041 @ Test
4142 void changelogParseExceptionDueToChangelogNotPresent () {
4243 FailureAnalysis analysis = performAnalysis ();
44+ assertThat (analysis ).isNotNull ();
4345 assertThat (analysis .getDescription ())
4446 .isEqualTo ("Liquibase failed to start because no changelog could be found at '"
4547 + "classpath:/db/changelog/db.changelog-master.yaml'." );
4648 assertThat (analysis .getAction ())
4749 .isEqualTo ("Make sure a Liquibase changelog is present at the configured path." );
4850 }
4951
50- private FailureAnalysis performAnalysis () {
52+ private @ Nullable FailureAnalysis performAnalysis () {
5153 BeanCreationException failure = createFailure ();
5254 assertThat (failure ).isNotNull ();
5355 return new LiquibaseChangelogMissingFailureAnalyzer ().analyze (failure );
5456 }
5557
56- private BeanCreationException createFailure () {
58+ private @ Nullable BeanCreationException createFailure () {
5759 try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext (
5860 LiquibaseConfiguration .class )) {
5961 return null ;
Original file line number Diff line number Diff line change 2525import java .nio .file .Files ;
2626import java .nio .file .Path ;
2727import java .sql .Connection ;
28+ import java .sql .Driver ;
2829import java .sql .SQLException ;
2930import java .util .Map ;
3031import java .util .UUID ;
@@ -334,7 +335,9 @@ void overrideDataSource() {
334335 .run (assertLiquibase ((liquibase ) -> {
335336 SimpleDriverDataSource dataSource = (SimpleDriverDataSource ) liquibase .getDataSource ();
336337 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" );
338341 }));
339342 }
340343
@@ -349,7 +352,9 @@ void overrideDataSourceAndDriverClassName() {
349352 .run (assertLiquibase ((liquibase ) -> {
350353 SimpleDriverDataSource dataSource = (SimpleDriverDataSource ) liquibase .getDataSource ();
351354 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 );
353358 }));
354359 }
355360
You can’t perform that action at this time.
0 commit comments