From 2d33998bc2d8941834b8313da3354c8cb8bb3764 Mon Sep 17 00:00:00 2001 From: Jens Kaiser Date: Sat, 30 Nov 2024 12:53:03 +0100 Subject: [PATCH] don't mix assertNotNull with assertThat --- ...sMonkeyRequestScopeRestEndpointIntegrationTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chaos-monkey-spring-boot/src/test/java/de/codecentric/spring/boot/chaos/monkey/endpoints/ChaosMonkeyRequestScopeRestEndpointIntegrationTest.java b/chaos-monkey-spring-boot/src/test/java/de/codecentric/spring/boot/chaos/monkey/endpoints/ChaosMonkeyRequestScopeRestEndpointIntegrationTest.java index 08a24646..387711b1 100644 --- a/chaos-monkey-spring-boot/src/test/java/de/codecentric/spring/boot/chaos/monkey/endpoints/ChaosMonkeyRequestScopeRestEndpointIntegrationTest.java +++ b/chaos-monkey-spring-boot/src/test/java/de/codecentric/spring/boot/chaos/monkey/endpoints/ChaosMonkeyRequestScopeRestEndpointIntegrationTest.java @@ -241,7 +241,7 @@ void getStatusIsEnabled() { ResponseEntity result = testRestTemplate.getForEntity(baseUrl + "/status", ChaosMonkeyStatusResponseDto.class); assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK); - assertNotNull(result.getBody()); + assertThat(result.getBody()).isNotNull(); assertThat(result.getBody().isEnabled()).isTrue(); } @@ -252,7 +252,7 @@ void getStatusIsDisabled() { ResponseEntity result = testRestTemplate.getForEntity(baseUrl + "/status", ChaosMonkeyStatusResponseDto.class); assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK); - assertNotNull(result.getBody()); + assertThat(result.getBody()).isNotNull(); assertThat(result.getBody().isEnabled()).isFalse(); } @@ -264,7 +264,7 @@ void postToEnableChaosMonkey() { ResponseEntity result = testRestTemplate.postForEntity(baseUrl + "/enable", null, ChaosMonkeyStatusResponseDto.class); - assertEquals(HttpStatus.OK, result.getStatusCode()); + assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(Objects.requireNonNull(result.getBody()).isEnabled()).isTrue(); assertThat(Objects.requireNonNull(result.getBody()).getEnabledAt()).isAfterOrEqualTo(enabledAt); } @@ -275,7 +275,7 @@ void postToDisableChaosMonkey() { ResponseEntity result = testRestTemplate.postForEntity(baseUrl + "/disable", null, ChaosMonkeyStatusResponseDto.class); - assertEquals(HttpStatus.OK, result.getStatusCode()); + assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(Objects.requireNonNull(result.getBody()).isEnabled()).isEqualTo(false); assertThat(Objects.requireNonNull(result.getBody()).getDisabledAt()).isNull(); } @@ -288,7 +288,7 @@ void postToDisableAfterEnableChaosMonkey() { ResponseEntity result = testRestTemplate.postForEntity(baseUrl + "/disable", null, ChaosMonkeyStatusResponseDto.class); - assertEquals(HttpStatus.OK, result.getStatusCode()); + assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(Objects.requireNonNull(result.getBody()).isEnabled()).isEqualTo(false); assertThat(Objects.requireNonNull(result.getBody()).getDisabledAt()).isAfterOrEqualTo(disabledAt); }