aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2019-12-09 09:34:43 -0600
committerSonarTech <sonartech@sonarsource.com>2019-12-10 20:46:09 +0100
commitd1fd889554bccbb50122550899dbb66b90b04f78 (patch)
tree9cad838366292ee79b77ac3513403f7489b06355 /sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper
parentf86a1094588e4e47b3abf612891af0431653cd0e (diff)
downloadsonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.tar.gz
sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.zip
Fix code quality issues and reduce dependency on Guava
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java9
2 files changed, 8 insertions, 9 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java
index 27fa806da8b..8b0ba3c1430 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.bootstrapper;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
@@ -42,7 +42,7 @@ public class LoggingConfigurationTest {
@Test
public void testSetVerboseAnalysis() {
- Map<String, String> props = Maps.newHashMap();
+ Map<String, String> props = new HashMap<>();
LoggingConfiguration conf = new LoggingConfiguration(null).setProperties(props);
assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_DEFAULT);
@@ -65,7 +65,7 @@ public class LoggingConfigurationTest {
@Test
public void test_deprecated_log_properties() {
- Map<String, String> properties = Maps.newHashMap();
+ Map<String, String> properties = new HashMap<>();
assertThat(new LoggingConfiguration(null).setProperties(properties)
.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_DEFAULT);
@@ -90,7 +90,7 @@ public class LoggingConfigurationTest {
@Test
public void test_log_level_property() {
- Map<String, String> properties = Maps.newHashMap();
+ Map<String, String> properties = new HashMap<>();
LoggingConfiguration conf = new LoggingConfiguration(null).setProperties(properties);
assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo("INFO");
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java
index e054fc2d2c8..79c3aaea2d7 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java
@@ -21,7 +21,6 @@ package org.sonar.batch.bootstrapper;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -55,7 +54,7 @@ public class LoggingConfiguratorTest {
listener = new SimpleLogListener();
}
- private class SimpleLogListener implements LogOutput {
+ private static class SimpleLogListener implements LogOutput {
String msg;
LogOutput.Level level;
@@ -67,7 +66,7 @@ public class LoggingConfiguratorTest {
}
@Test
- public void testWithFile() throws FileNotFoundException, IOException {
+ public void testWithFile() throws IOException {
InputStream is = this.getClass().getResourceAsStream(DEFAULT_CLASSPATH_CONF);
File tmpFolder = folder.getRoot();
File testFile = new File(tmpFolder, "test");
@@ -86,7 +85,7 @@ public class LoggingConfiguratorTest {
}
@Test
- public void testCustomAppender() throws UnsupportedEncodingException {
+ public void testCustomAppender() {
conf.setLogOutput(listener);
LoggingConfigurator.apply(conf);
@@ -129,7 +128,7 @@ public class LoggingConfiguratorTest {
}
@Test
- public void testFormatNoEffect() throws UnsupportedEncodingException {
+ public void testFormatNoEffect() {
conf.setLogOutput(listener);
conf.setFormat("%t");