From 08cf32bb896fb0ec81619c5ab206fafbd187c3c7 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Wed, 18 May 2011 09:53:07 +0200 Subject: [PATCH] SONAR-2347 CloseReviewsDecorator should execute only if isLastestAnalysis Forgot to commit the test --- .../core/sensors/CloseReviewsDecoratorTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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"); -- 2.39.5