aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-shutdowner
diff options
context:
space:
mode:
authorKlaudio Sinani <klaudio.sinani@sonarsource.com>2021-11-17 22:54:06 +0100
committersonartech <sonartech@sonarsource.com>2021-11-19 20:03:27 +0000
commita3d88ea27c35921647d7602755828ca73e15e865 (patch)
tree5626c38afab1ea00ab9897da431476c17b478bbe /sonar-shutdowner
parent92f482f2aa43e4aa36e0fda377d13b9dc3282ff9 (diff)
downloadsonarqube-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.java13
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