From: Fabrice Bellingard Date: Wed, 18 May 2011 07:53:07 +0000 (+0200) Subject: SONAR-2347 CloseReviewsDecorator should execute only if isLastestAnalysis X-Git-Tag: 2.8~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=08cf32bb896fb0ec81619c5ab206fafbd187c3c7;p=sonarqube.git SONAR-2347 CloseReviewsDecorator should execute only if isLastestAnalysis Forgot to commit the test --- diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest.java index c4c2ff53c2d..2ea8a7c1de4 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest.java @@ -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");