diff options
author | Klaudio Sinani <klaudio.sinani@sonarsource.com> | 2021-11-17 22:54:06 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-11-19 20:03:27 +0000 |
commit | a3d88ea27c35921647d7602755828ca73e15e865 (patch) | |
tree | 5626c38afab1ea00ab9897da431476c17b478bbe /sonar-shutdowner | |
parent | 92f482f2aa43e4aa36e0fda377d13b9dc3282ff9 (diff) | |
download | sonarqube-a3d88ea27c35921647d7602755828ca73e15e865.tar.gz sonarqube-a3d88ea27c35921647d7602755828ca73e15e865.zip |
SONAR-15631 - Refactor UTs to stop using ExpectedException
Diffstat (limited to 'sonar-shutdowner')
-rw-r--r-- | sonar-shutdowner/src/test/java/org/sonar/application/ShutdownerTest.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sonar-shutdowner/src/test/java/org/sonar/application/ShutdownerTest.java b/sonar-shutdowner/src/test/java/org/sonar/application/ShutdownerTest.java index afd0cec13ef..d6f027d3287 100644 --- a/sonar-shutdowner/src/test/java/org/sonar/application/ShutdownerTest.java +++ b/sonar-shutdowner/src/test/java/org/sonar/application/ShutdownerTest.java @@ -30,17 +30,15 @@ import java.util.Properties; import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; public class ShutdownerTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - + private File srcFile; @Before @@ -58,10 +56,9 @@ public class ShutdownerTest { public void loadPropertiesFile_fails_with_ISE_if_sonar_properties_not_in_conf_dir() throws IOException { File homeDir = temporaryFolder.newFolder(); - expectedException.expect(IllegalStateException.class); - expectedException.expectMessage("Configuration file not found: " + new File(new File(homeDir, "conf"), "sonar.properties").getAbsolutePath()); - - Shutdowner.loadPropertiesFile(homeDir); + assertThatThrownBy(() -> Shutdowner.loadPropertiesFile(homeDir)) + .isInstanceOf(IllegalStateException.class) + .hasMessage("Configuration file not found: " + new File(new File(homeDir, "conf"), "sonar.properties").getAbsolutePath()); } @Test |