diff --git a/narayana-spring-boot-core/src/test/java/dev/snowdrop/boot/narayana/core/jdbc/DataSourceXAResourceRecoveryHelperTests.java b/narayana-spring-boot-core/src/test/java/dev/snowdrop/boot/narayana/core/jdbc/DataSourceXAResourceRecoveryHelperTests.java index 4ef55555..1fa410ad 100644 --- a/narayana-spring-boot-core/src/test/java/dev/snowdrop/boot/narayana/core/jdbc/DataSourceXAResourceRecoveryHelperTests.java +++ b/narayana-spring-boot-core/src/test/java/dev/snowdrop/boot/narayana/core/jdbc/DataSourceXAResourceRecoveryHelperTests.java @@ -43,10 +43,10 @@ @ExtendWith(MockitoExtension.class) class DataSourceXAResourceRecoveryHelperTests { - @Mock(lenient = true) + @Mock(strictness = Mock.Strictness.LENIENT) private XADataSource mockXaDataSource; - @Mock(lenient = true) + @Mock(strictness = Mock.Strictness.LENIENT) private XAConnection mockXaConnection; @Mock @@ -65,7 +65,7 @@ void before() throws SQLException { @Test void shouldCreateConnectionAndGetXAResource() throws SQLException { XAResource[] xaResources = this.recoveryHelper.getXAResources(); - assertThat(xaResources.length).isEqualTo(1); + assertThat(xaResources).hasSize(1); assertThat(xaResources[0]).isSameAs(this.recoveryHelper); verify(this.mockXaDataSource).getXAConnection(); } @@ -75,7 +75,7 @@ void shouldCreateConnectionWithCredentialsAndGetXAResource() throws SQLException given(this.mockXaDataSource.getXAConnection(anyString(), anyString())).willReturn(this.mockXaConnection); this.recoveryHelper = new DataSourceXAResourceRecoveryHelper(this.mockXaDataSource, "username", "password"); XAResource[] xaResources = this.recoveryHelper.getXAResources(); - assertThat(xaResources.length).isEqualTo(1); + assertThat(xaResources).hasSize(1); assertThat(xaResources[0]).isSameAs(this.recoveryHelper); verify(this.mockXaDataSource).getXAConnection("username", "password"); } @@ -84,7 +84,7 @@ void shouldCreateConnectionWithCredentialsAndGetXAResource() throws SQLException void shouldFailToCreateConnectionAndNotGetXAResource() throws SQLException { given(this.mockXaDataSource.getXAConnection()).willThrow(new SQLException("Test exception")); XAResource[] xaResources = this.recoveryHelper.getXAResources(); - assertThat(xaResources.length).isEqualTo(0); + assertThat(xaResources).isEmpty(); verify(this.mockXaDataSource).getXAConnection(); verify(this.mockXaConnection, times(0)).getXAResource(); } diff --git a/narayana-spring-boot-starter-it/src/test/java/dev/snowdrop/boot/narayana/generic/GenericRecoveryIT.java b/narayana-spring-boot-starter-it/src/test/java/dev/snowdrop/boot/narayana/generic/GenericRecoveryIT.java index e3ffa64a..916e8dae 100644 --- a/narayana-spring-boot-starter-it/src/test/java/dev/snowdrop/boot/narayana/generic/GenericRecoveryIT.java +++ b/narayana-spring-boot-starter-it/src/test/java/dev/snowdrop/boot/narayana/generic/GenericRecoveryIT.java @@ -128,13 +128,13 @@ void testCrashBeforeCommit() throws Exception { protected void assertEntriesAfterCrash(List entries) { assertThat(entries) .as("No entry should exist") - .hasSize(0); + .isEmpty(); } protected void assertMessagesAfterCrash(List messages) { assertThat(messages) .as("No message should exist") - .hasSize(0); + .isEmpty(); } protected void assertEntriesAfterRecovery(List entries) {