mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:25:50 +00:00
test: rewrite assertion using AssertJ for consistency
This commit is contained in:
parent
5941227ab3
commit
4f78b07490
1 changed files with 5 additions and 7 deletions
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.samples.petclinic.system;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -34,13 +34,11 @@ class CrashControllerTests {
|
|||
CrashController testee = new CrashController();
|
||||
|
||||
@Test
|
||||
void testTriggerException() throws Exception {
|
||||
RuntimeException thrown = assertThrows(RuntimeException.class, () -> {
|
||||
testee.triggerException();
|
||||
});
|
||||
void testTriggerException() {
|
||||
RuntimeException thrown = assertThrows(RuntimeException.class, () -> testee.triggerException());
|
||||
|
||||
assertEquals("Expected: controller used to showcase what happens when an exception is thrown",
|
||||
thrown.getMessage());
|
||||
assertThat(thrown.getMessage())
|
||||
.isEqualTo("Expected: controller used to showcase what happens when an exception is thrown");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue