]> source.dussan.org Git - sonarqube.git/commitdiff
Fix violations
authorFabrice Bellingard <bellingard@gmail.com>
Thu, 24 May 2012 08:23:10 +0000 (10:23 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Thu, 24 May 2012 08:23:10 +0000 (10:23 +0200)
plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsExecutorTest.java
sonar-core/src/main/java/org/sonar/core/review/workflow/WorkflowEngine.java
sonar-core/src/main/java/org/sonar/core/review/workflow/review/Comment.java

index 4bea359f559bbf10d1041bd427ede040e59c41b2..adc231ac5296d4cb024864a7e55e6ea6de5bc433 100644 (file)
  */
 package org.sonar.plugins.findbugs;
 
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.internal.matchers.StringContains.containsString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.File;
-
+import com.google.common.collect.Lists;
 import org.apache.commons.io.FileUtils;
 import org.junit.Test;
 import org.sonar.api.CoreProperties;
@@ -34,6 +27,14 @@ import org.sonar.api.resources.Project;
 import org.sonar.api.resources.ProjectFileSystem;
 import org.sonar.api.utils.SonarException;
 
+import java.io.File;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.internal.matchers.StringContains.containsString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 public class FindbugsExecutorTest {
 
   @Test
@@ -78,6 +79,7 @@ public class FindbugsExecutorTest {
     when(conf.getFindbugsProject()).thenReturn(project);
     when(conf.saveExcludeConfigXml()).thenReturn(new File("test-resources/findbugs-exclude.xml"));
     when(conf.saveIncludeConfigXml()).thenReturn(new File("test-resources/findbugs-include.xml"));
+    when(conf.getExcludesFilters()).thenReturn(Lists.newArrayList(new File("test-resources/findbugs-exclude.xml"), new File("test-resources/fake-file.xml")));
     when(conf.getEffort()).thenReturn("default");
     when(conf.getTimeout()).thenReturn(CoreProperties.FINDBUGS_TIMEOUT_DEFAULT_VALUE);
     return conf;
index 4c7c17fec176487a6e104a413c972be911a41777..08261723eedf1c8e5018f510b7b2608778a78132 100644 (file)
@@ -29,10 +29,15 @@ import org.sonar.api.ServerComponent;
 import org.sonar.api.config.Settings;
 import org.sonar.core.review.workflow.condition.Condition;
 import org.sonar.core.review.workflow.function.Function;
-import org.sonar.core.review.workflow.review.*;
+import org.sonar.core.review.workflow.review.DefaultReview;
+import org.sonar.core.review.workflow.review.DefaultWorkflowContext;
+import org.sonar.core.review.workflow.review.MutableReview;
+import org.sonar.core.review.workflow.review.Review;
+import org.sonar.core.review.workflow.review.WorkflowContext;
 import org.sonar.core.review.workflow.screen.Screen;
 
 import javax.annotation.Nullable;
+
 import java.util.List;
 import java.util.Map;
 
@@ -112,13 +117,13 @@ public class WorkflowEngine implements ServerComponent {
   }
 
   private boolean verifyConditionsQuietly(@Nullable Review review, WorkflowContext context, List<Condition> conditions) {
-      for (Condition condition : conditions) {
-        if (!condition.doVerify(review, context)) {
-          return false;
-        }
+    for (Condition condition : conditions) {
+      if (!condition.doVerify(review, context)) {
+        return false;
       }
-      return true;
     }
+    return true;
+  }
 
   private void verifyConditions(@Nullable Review review, WorkflowContext context, List<Condition> conditions) {
     for (Condition condition : conditions) {
index f040d81b7220d708339cb0e15058a77a3995539e..a3a332eb5a5775c55e8e14a73fa219e91d03ae3e 100644 (file)
@@ -22,7 +22,7 @@ package org.sonar.core.review.workflow.review;
 import org.apache.commons.lang.builder.ReflectionToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
 
-public class Comment {
+public class Comment implements Cloneable {
   private String markdownText;
   private Long userId;