Skip to content

Commit

Permalink
don't mix assertNotNull with assertThat
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Kaiser committed Nov 30, 2024
1 parent 0909bed commit 2d33998
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void getStatusIsEnabled() {
ResponseEntity<ChaosMonkeyStatusResponseDto> 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();
}

Expand All @@ -252,7 +252,7 @@ void getStatusIsDisabled() {
ResponseEntity<ChaosMonkeyStatusResponseDto> 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();
}

Expand All @@ -264,7 +264,7 @@ void postToEnableChaosMonkey() {
ResponseEntity<ChaosMonkeyStatusResponseDto> 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);
}
Expand All @@ -275,7 +275,7 @@ void postToDisableChaosMonkey() {
ResponseEntity<ChaosMonkeyStatusResponseDto> 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();
}
Expand All @@ -288,7 +288,7 @@ void postToDisableAfterEnableChaosMonkey() {
ResponseEntity<ChaosMonkeyStatusResponseDto> 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);
}
Expand Down

0 comments on commit 2d33998

Please sign in to comment.