aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java
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-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java
parent92f482f2aa43e4aa36e0fda377d13b9dc3282ff9 (diff)
downloadsonarqube-a3d88ea27c35921647d7602755828ca73e15e865.tar.gz
sonarqube-a3d88ea27c35921647d7602755828ca73e15e865.zip
SONAR-15631 - Refactor UTs to stop using ExpectedException
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java
index ba1f0401a5c..bd585b6a4b6 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java
@@ -25,17 +25,15 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.sonar.scanner.WsTestUtil;
import org.sonar.scanner.bootstrap.DefaultScannerWsClient;
import org.sonarqube.ws.Rules.ListResponse.Rule;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
public class DefaultRulesLoaderTest {
- @org.junit.Rule
- public ExpectedException exception = ExpectedException.none();
@Test
public void testParseServerResponse() throws IOException {
@@ -54,9 +52,8 @@ public class DefaultRulesLoaderTest {
WsTestUtil.mockStream(wsClient, is);
DefaultRulesLoader loader = new DefaultRulesLoader(wsClient);
- exception.expect(IllegalStateException.class);
- exception.expectMessage("Unable to get rules");
-
- loader.load();
+ assertThatThrownBy(() -> loader.load())
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("Unable to get rules");
}
}