aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2012-11-27 11:06:21 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2012-11-27 11:09:14 +0100
commitf63d67c5574ab1cbbbfaecf5a5054be447f7c495 (patch)
tree3b9ed95606f3b4676846a7b18020e3bd9493d525
parent16c86195a6f172ad79fe27fa6d6b80c4515b71e7 (diff)
downloadsonarqube-f63d67c5574ab1cbbbfaecf5a5054be447f7c495.tar.gz
sonarqube-f63d67c5574ab1cbbbfaecf5a5054be447f7c495.zip
Fix test that assert on Findbugs violation message independent of Locale.
On my french laptop the test "shouldExecuteFindbugsWhenNoReportProvided" failed because Findbugs violation message was in french.
-rw-r--r--plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java
index 82379f3b1a7..2416cc580c4 100644
--- a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java
+++ b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java
@@ -20,17 +20,29 @@
package org.sonar.plugins.findbugs;
import com.google.common.collect.Lists;
-import edu.umd.cs.findbugs.*;
+import edu.umd.cs.findbugs.BugCollection;
+import edu.umd.cs.findbugs.BugInstance;
+import edu.umd.cs.findbugs.ClassAnnotation;
+import edu.umd.cs.findbugs.MethodAnnotation;
+import edu.umd.cs.findbugs.SortedBugCollection;
+import edu.umd.cs.findbugs.SourceLineAnnotation;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.profiles.RulesProfile;
-import org.sonar.api.resources.*;
+import org.sonar.api.resources.InputFile;
+import org.sonar.api.resources.InputFileUtils;
+import org.sonar.api.resources.JavaFile;
import org.sonar.api.resources.Project;
+import org.sonar.api.resources.ProjectFileSystem;
+import org.sonar.api.resources.Resource;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.Violation;
import org.sonar.api.test.IsViolation;
import java.util.ArrayList;
+import java.util.Locale;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.any;
@@ -43,6 +55,18 @@ import static org.mockito.Mockito.when;
public class FindbugsSensorTest extends FindbugsTests {
+ private static final Locale DEFAULT_LOCALE = Locale.getDefault();
+
+ @BeforeClass
+ public static void beforeAll() {
+ Locale.setDefault(Locale.ENGLISH);
+ }
+
+ @AfterClass
+ public static void afterAll() {
+ Locale.setDefault(DEFAULT_LOCALE);
+ }
+
@Test
public void shouldNotAnalyseIfNoJavaProject() {
Project project = mock(Project.class);