From 8c4b4e6368f168d82d1a0a1d1f7d0292b2ff53bc Mon Sep 17 00:00:00 2001 From: Carlo Ronconi <101140996+carloronconi@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:16:14 +0100 Subject: [PATCH] test: replace double assertion assertThrows and assertThat with single assertj's assertThatIOException in RegistryServiceTest (#2741) --- .../kit/build/service/docker/RegistryServiceTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/jkube-kit/build/service/docker/src/test/java/org/eclipse/jkube/kit/build/service/docker/RegistryServiceTest.java b/jkube-kit/build/service/docker/src/test/java/org/eclipse/jkube/kit/build/service/docker/RegistryServiceTest.java index 53cad93149..788918211a 100644 --- a/jkube-kit/build/service/docker/src/test/java/org/eclipse/jkube/kit/build/service/docker/RegistryServiceTest.java +++ b/jkube-kit/build/service/docker/src/test/java/org/eclipse/jkube/kit/build/service/docker/RegistryServiceTest.java @@ -29,7 +29,7 @@ import java.util.Properties; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.assertj.core.api.Assertions.assertThatIOException; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; @@ -64,11 +64,10 @@ void setUp() { @Test void pullImageWithPolicy_pullPolicyNeverAndNoImage_shouldThrowException() { - // When - final IOException result = assertThrows(IOException.class, () -> registryService.pullImageWithPolicy("image", - ImagePullManager.createImagePullManager("Never", "", new Properties()), null, null)); - // Then - assertThat(result).hasMessageStartingWith("No image 'image' found and pull policy 'Never' is set"); + assertThatIOException() + .isThrownBy(() -> registryService.pullImageWithPolicy("image", + ImagePullManager.createImagePullManager("Never", "", new Properties()), null, null)) + .withMessageStartingWith("No image 'image' found and pull policy 'Never' is set"); } @Test