aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-xoo-plugin/src/test/java/org/sonar
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-04-13 09:16:32 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-04-14 10:14:30 +0200
commit91a01dfc9e3d78cbe8b855912202540a66a74cdf (patch)
tree5865e8bba0934d31b628683605197f327f049ae4 /plugins/sonar-xoo-plugin/src/test/java/org/sonar
parentbd314784e17f2b0573a9e6a25e6a7b8a231c5ed1 (diff)
downloadsonarqube-91a01dfc9e3d78cbe8b855912202540a66a74cdf.tar.gz
sonarqube-91a01dfc9e3d78cbe8b855912202540a66a74cdf.zip
SONAR-6408 Restore PostJob execution in preview mode
Diffstat (limited to 'plugins/sonar-xoo-plugin/src/test/java/org/sonar')
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/extensions/XooPostJobTest.java49
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java5
2 files changed, 51 insertions, 3 deletions
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/extensions/XooPostJobTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/extensions/XooPostJobTest.java
new file mode 100644
index 00000000000..4af975c172e
--- /dev/null
+++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/extensions/XooPostJobTest.java
@@ -0,0 +1,49 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.xoo.extensions;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.api.batch.postjob.PostJobContext;
+import org.sonar.api.batch.postjob.internal.DefaultPostJobDescriptor;
+import org.sonar.api.batch.postjob.issue.Issue;
+import org.sonar.api.utils.log.LogTester;
+
+import java.util.Arrays;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class XooPostJobTest {
+
+ @Rule
+ public LogTester logTester = new LogTester();
+
+ @Test
+ public void increaseCoverage() {
+ new XooPostJob().describe(new DefaultPostJobDescriptor());
+ PostJobContext context = mock(PostJobContext.class);
+ when(context.issues()).thenReturn(Arrays.<Issue>asList());
+ when(context.resolvedIssues()).thenReturn(Arrays.<Issue>asList());
+ new XooPostJob().execute(context);
+ assertThat(logTester.logs()).contains("Resolved issues: 0", "Open issues: 0");
+ }
+}
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java
index ab8ea247d35..a3cbbf5eb84 100644
--- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java
+++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java
@@ -19,8 +19,6 @@
*/
package org.sonar.xoo.rule;
-import org.sonar.api.batch.sensor.internal.SensorStorage;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -29,10 +27,11 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
+import org.sonar.api.batch.rule.Severity;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
+import org.sonar.api.batch.sensor.internal.SensorStorage;
import org.sonar.api.batch.sensor.issue.Issue;
-import org.sonar.api.batch.sensor.issue.Issue.Severity;
import org.sonar.api.batch.sensor.issue.internal.DefaultIssue;
import org.sonar.api.config.Settings;
import org.sonar.xoo.Xoo;