Constently use assertThatExceptionOf... assertions

Closes gh-37964
This commit is contained in:
Phillip Webb
2023-10-19 20:17:26 -07:00
parent fe69930ac7
commit abdad1cabe
20 changed files with 103 additions and 95 deletions

View File

@@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.build.mavenplugin.PluginXmlParser.Plugin;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* Tests for {@link PluginXmlParser}.
@@ -50,9 +50,9 @@ class PluginXmlParserTests {
@Test
void parseNonExistingFileThrowException() {
assertThatThrownBy(() -> this.parser.parse(new File("src/test/resources/nonexistent.xml")))
.isInstanceOf(RuntimeException.class)
.hasCauseInstanceOf(FileNotFoundException.class);
assertThatExceptionOfType(RuntimeException.class)
.isThrownBy(() -> this.parser.parse(new File("src/test/resources/nonexistent.xml")))
.withCauseInstanceOf(FileNotFoundException.class);
}
}