]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2347 CloseReviewsDecorator should execute only if isLastestAnalysis
authorFabrice Bellingard <bellingard@gmail.com>
Wed, 18 May 2011 07:53:07 +0000 (09:53 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 18 May 2011 07:53:07 +0000 (09:53 +0200)
Forgot to commit the test

plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest.java

index c4c2ff53c2d9c4f1a4a49c67a5750837c9d1cf84..2ea8a7c1de4ae1b8193150f459bea117911315de 100644 (file)
@@ -21,17 +21,29 @@ package org.sonar.plugins.core.sensors;
 
 import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.sql.Statement;
 
 import junit.framework.ComparisonFailure;
 
 import org.junit.Test;
+import org.sonar.api.resources.Project;
 import org.sonar.test.persistence.DatabaseTestCase;
 
 public class CloseReviewsDecoratorTest extends DatabaseTestCase {
 
+  @Test
+  public void testShouldExecuteOnProject() throws Exception {
+    Project project = mock(Project.class);
+    when(project.isLatestAnalysis()).thenReturn(true);
+    CloseReviewsDecorator reviewsDecorator = new CloseReviewsDecorator(null, null);
+    assertTrue(reviewsDecorator.shouldExecuteOnProject(project));
+  }
+
   @Test
   public void shouldCloseReviewWithoutCorrespondingViolation() throws Exception {
     setupData("fixture");