aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2016-05-10 18:12:35 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2016-05-12 08:49:09 +0200
commitf785c62ff8259184c889eacea78c5dc25cb9e1a3 (patch)
tree7041dfa84407c19f3287d1a9e4b4d50e8f9dad96 /sonar-scanner-engine/src/test/java/org/sonar/batch
parent73f40c17f4b9cdd03636d7198ac5ae1b563de7d1 (diff)
downloadsonarqube-f785c62ff8259184c889eacea78c5dc25cb9e1a3.tar.gz
sonarqube-f785c62ff8259184c889eacea78c5dc25cb9e1a3.zip
SONAR-7612 Move new Sensor API out of @Beta
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/batch')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/DefaultPostJobContextTest.java16
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java18
2 files changed, 6 insertions, 28 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/DefaultPostJobContextTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/DefaultPostJobContextTest.java
index 12f00a55d90..5f9916919ec 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/DefaultPostJobContextTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/DefaultPostJobContextTest.java
@@ -19,20 +19,18 @@
*/
package org.sonar.batch.postjob;
-import org.sonar.batch.issue.tracking.TrackedIssue;
-
import java.util.Arrays;
-
import org.junit.Before;
import org.junit.Test;
-import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.postjob.issue.Issue;
+import org.sonar.api.batch.postjob.issue.PostJobIssue;
import org.sonar.api.batch.rule.Severity;
import org.sonar.api.config.Settings;
import org.sonar.api.resources.File;
import org.sonar.batch.index.BatchComponentCache;
import org.sonar.batch.issue.IssueCache;
+import org.sonar.batch.issue.tracking.TrackedIssue;
+
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -41,7 +39,6 @@ public class DefaultPostJobContextTest {
private IssueCache issueCache;
private BatchComponentCache resourceCache;
- private AnalysisMode analysisMode;
private DefaultPostJobContext context;
private Settings settings;
@@ -49,15 +46,13 @@ public class DefaultPostJobContextTest {
public void prepare() {
issueCache = mock(IssueCache.class);
resourceCache = new BatchComponentCache();
- analysisMode = mock(AnalysisMode.class);
settings = new Settings();
- context = new DefaultPostJobContext(settings, analysisMode, issueCache, resourceCache);
+ context = new DefaultPostJobContext(settings, issueCache, resourceCache);
}
@Test
public void test() {
assertThat(context.settings()).isSameAs(settings);
- assertThat(context.analysisMode()).isSameAs(analysisMode);
TrackedIssue defaultIssue = new TrackedIssue();
defaultIssue.setComponentKey("foo:src/Foo.php");
@@ -69,9 +64,8 @@ public class DefaultPostJobContextTest {
defaultIssue.setSeverity("BLOCKER");
when(issueCache.all()).thenReturn(Arrays.asList(defaultIssue));
- Issue issue = context.issues().iterator().next();
+ PostJobIssue issue = context.issues().iterator().next();
assertThat(issue.componentKey()).isEqualTo("foo:src/Foo.php");
- assertThat(issue.effortToFix()).isEqualTo(2.0);
assertThat(issue.isNew()).isTrue();
assertThat(issue.key()).isEqualTo("xyz");
assertThat(issue.line()).isEqualTo(1);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java
index e5d30f1dfa3..3420e45f209 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java
@@ -23,13 +23,10 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.postjob.internal.DefaultPostJobDescriptor;
import org.sonar.api.config.Settings;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
public class PostJobOptimizerTest {
@@ -38,13 +35,11 @@ public class PostJobOptimizerTest {
private PostJobOptimizer optimizer;
private Settings settings;
- private AnalysisMode analysisMode;
@Before
public void prepare() {
settings = new Settings();
- analysisMode = mock(AnalysisMode.class);
- optimizer = new PostJobOptimizer(settings, analysisMode);
+ optimizer = new PostJobOptimizer(settings);
}
@Test
@@ -63,15 +58,4 @@ public class PostJobOptimizerTest {
settings.setProperty("sonar.foo.reportPath", "foo");
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
-
- @Test
- public void should_disabled_in_issues_mode() {
- DefaultPostJobDescriptor descriptor = new DefaultPostJobDescriptor()
- .disabledInIssues();
- assertThat(optimizer.shouldExecute(descriptor)).isTrue();
-
- when(analysisMode.isIssues()).thenReturn(true);
-
- assertThat(optimizer.shouldExecute(descriptor)).isFalse();
- }
}