aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-cpd-plugin/src
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-09-19 18:08:26 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-09-22 10:49:34 +0200
commit14f36bfb794a37ac67b643924e8608421a8f549c (patch)
treeb8cf4ee1232bcd5376fb5801a0901a340d48f626 /plugins/sonar-cpd-plugin/src
parent78a1280ead8a756ca52dc13ce31b17e08ab2f703 (diff)
downloadsonarqube-14f36bfb794a37ac67b643924e8608421a8f549c.tar.gz
sonarqube-14f36bfb794a37ac67b643924e8608421a8f549c.zip
SONAR-5389 Refactor new issue API
Diffstat (limited to 'plugins/sonar-cpd-plugin/src')
-rw-r--r--plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/JavaCpdEngineTest.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/JavaCpdEngineTest.java b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/JavaCpdEngineTest.java
index d2dd4d2d32c..1b565ff56b3 100644
--- a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/JavaCpdEngineTest.java
+++ b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/JavaCpdEngineTest.java
@@ -29,8 +29,8 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DeprecatedDefaultInputFile;
-import org.sonar.api.batch.sensor.SensorStorage;
import org.sonar.api.batch.sensor.SensorContext;
+import org.sonar.api.batch.sensor.SensorStorage;
import org.sonar.api.batch.sensor.duplication.DuplicationGroup;
import org.sonar.api.batch.sensor.duplication.internal.DefaultDuplicationBuilder;
import org.sonar.api.batch.sensor.measure.Measure;
@@ -63,14 +63,14 @@ public class JavaCpdEngineTest {
private DefaultDuplicationBuilder duplicationBuilder;
private FileLinesContextFactory contextFactory;
private FileLinesContext linesContext;
- private SensorStorage<Measure> persister = mock(SensorStorage.class);
+ private SensorStorage storage = mock(SensorStorage.class);
@Before
public void before() throws IOException {
when(context.newMeasure()).then(new Answer<Measure>() {
@Override
public Measure answer(InvocationOnMock invocation) throws Throwable {
- return new DefaultMeasure(persister);
+ return new DefaultMeasure(storage);
}
});
inputFile = new DeprecatedDefaultInputFile("foo", "src/main/java/Foo.java");
@@ -97,9 +97,9 @@ public class JavaCpdEngineTest {
List<CloneGroup> groups = Arrays.asList(newCloneGroup(new ClonePart("key1", 0, 5, 204), new ClonePart("key2", 0, 15, 214)));
JavaCpdEngine.save(context, inputFile, groups, contextFactory);
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_FILES).onFile(inputFile).withValue(1));
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_BLOCKS).onFile(inputFile).withValue(1));
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_LINES).onFile(inputFile).withValue(200));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_FILES).onFile(inputFile).withValue(1));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_BLOCKS).onFile(inputFile).withValue(1));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_LINES).onFile(inputFile).withValue(200));
InOrder inOrder = Mockito.inOrder(duplicationBuilder);
inOrder.verify(duplicationBuilder).originBlock(5, 204);
@@ -118,9 +118,9 @@ public class JavaCpdEngineTest {
List<CloneGroup> groups = Arrays.asList(newCloneGroup(new ClonePart("key1", 0, 5, 204), new ClonePart("key1", 0, 215, 414)));
JavaCpdEngine.save(context, inputFile, groups, contextFactory);
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_FILES).onFile(inputFile).withValue(1));
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_BLOCKS).onFile(inputFile).withValue(2));
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_LINES).onFile(inputFile).withValue(400));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_FILES).onFile(inputFile).withValue(1));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_BLOCKS).onFile(inputFile).withValue(2));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_LINES).onFile(inputFile).withValue(400));
InOrder inOrder = Mockito.inOrder(duplicationBuilder);
inOrder.verify(duplicationBuilder).originBlock(5, 204);
@@ -133,9 +133,9 @@ public class JavaCpdEngineTest {
List<CloneGroup> groups = Arrays.asList(newCloneGroup(new ClonePart("key1", 0, 5, 204), new ClonePart("key2", 0, 15, 214), new ClonePart("key3", 0, 25, 224)));
JavaCpdEngine.save(context, inputFile, groups, contextFactory);
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_FILES).onFile(inputFile).withValue(1));
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_BLOCKS).onFile(inputFile).withValue(1));
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_LINES).onFile(inputFile).withValue(200));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_FILES).onFile(inputFile).withValue(1));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_BLOCKS).onFile(inputFile).withValue(1));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_LINES).onFile(inputFile).withValue(200));
InOrder inOrder = Mockito.inOrder(duplicationBuilder);
inOrder.verify(duplicationBuilder).originBlock(5, 204);
@@ -157,9 +157,9 @@ public class JavaCpdEngineTest {
newCloneGroup(new ClonePart("key1", 0, 15, 214), new ClonePart("key3", 0, 15, 214)));
JavaCpdEngine.save(context, inputFile, groups, contextFactory);
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_FILES).onFile(inputFile).withValue(1));
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_BLOCKS).onFile(inputFile).withValue(2));
- verify(persister).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_LINES).onFile(inputFile).withValue(210));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_FILES).onFile(inputFile).withValue(1));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_BLOCKS).onFile(inputFile).withValue(2));
+ verify(storage).store(new DefaultMeasure().forMetric(CoreMetrics.DUPLICATED_LINES).onFile(inputFile).withValue(210));
InOrder inOrder = Mockito.inOrder(duplicationBuilder);
inOrder.verify(duplicationBuilder).originBlock(5, 204);