diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-03-20 16:12:20 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-03-23 10:55:44 +0100 |
commit | 7b2066e95e177700b41f86b30468cbca12cb5f5a (patch) | |
tree | 0bd38a280402b9483b5e5d552fbe6f8d2e870f37 /sonar-batch/src/test/java/org | |
parent | 99c983079b5cd16c34f6407fcfac9cb5b7e821d9 (diff) | |
download | sonarqube-7b2066e95e177700b41f86b30468cbca12cb5f5a.tar.gz sonarqube-7b2066e95e177700b41f86b30468cbca12cb5f5a.zip |
SONAR-6275 Feed measures in compute report
Diffstat (limited to 'sonar-batch/src/test/java/org')
4 files changed, 163 insertions, 369 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/DuplicationPersisterTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/DuplicationPersisterTest.java deleted file mode 100644 index c12eee78b4c..00000000000 --- a/sonar-batch/src/test/java/org/sonar/batch/index/DuplicationPersisterTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.batch.index; - -import org.junit.Before; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.batch.sensor.duplication.Duplication; -import org.sonar.api.batch.sensor.duplication.internal.DefaultDuplication; -import org.sonar.api.database.model.Snapshot; -import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.measures.MetricFinder; -import org.sonar.api.resources.File; -import org.sonar.api.rules.RuleFinder; -import org.sonar.batch.duplication.DuplicationCache; -import org.sonar.core.persistence.AbstractDaoTestCase; - -import java.util.Arrays; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class DuplicationPersisterTest extends AbstractDaoTestCase { - - @org.junit.Rule - public ExpectedException thrown = ExpectedException.none(); - - public static final int FILE_SNAPSHOT_ID = 3003; - - DuplicationPersister duplicationPersister; - RuleFinder ruleFinder = mock(RuleFinder.class); - File aFile = File.create("org/foo/Bar.java"); - Snapshot fileSnapshot = snapshot(FILE_SNAPSHOT_ID); - - private DuplicationCache duplicationCache; - - @Before - public void mockResourcePersister() { - duplicationCache = mock(DuplicationCache.class); - - ResourceCache resourceCache = mock(ResourceCache.class); - BatchResource batchResource = mock(BatchResource.class); - when(batchResource.resource()).thenReturn(aFile); - when(batchResource.snapshotId()).thenReturn(FILE_SNAPSHOT_ID); - when(resourceCache.get("foo:org/foo/Bar.java")).thenReturn(batchResource); - - MetricFinder metricFinder = mock(MetricFinder.class); - when(metricFinder.findByKey(CoreMetrics.DUPLICATIONS_DATA_KEY)).thenReturn(CoreMetrics.DUPLICATIONS_DATA.setId(2)); - - duplicationPersister = new DuplicationPersister(getMyBatis(), ruleFinder, resourceCache, duplicationCache, metricFinder); - } - - @Test - public void should_insert_duplications() { - setupData("empty"); - - Duplication.Block originBlock = new Duplication.Block("foo:org/foo/Bar.java", 1, 4); - - DefaultDuplication group = new DefaultDuplication().setOriginBlock(originBlock); - group.duplicates().add(new Duplication.Block("foo:org/foo/Foo.java", 5, 9)); - - when(duplicationCache.componentKeys()).thenReturn(Arrays.asList("foo:org/foo/Bar.java")); - - when(duplicationCache.byComponent("foo:org/foo/Bar.java")).thenReturn(Arrays.asList(group)); - - duplicationPersister.persist(); - - checkTables("shouldInsertDuplication", "project_measures"); - } - - private static Snapshot snapshot(int id) { - Snapshot snapshot = mock(Snapshot.class); - when(snapshot.getId()).thenReturn(id); - return snapshot; - } - -} diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java deleted file mode 100644 index fb59aa4d0a5..00000000000 --- a/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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.batch.index; - -import org.apache.commons.lang.StringUtils; -import org.junit.Before; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.database.model.Snapshot; -import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.measures.Measure; -import org.sonar.api.measures.Metric; -import org.sonar.api.measures.MetricFinder; -import org.sonar.api.measures.PersistenceMode; -import org.sonar.api.measures.RuleMeasure; -import org.sonar.api.resources.Directory; -import org.sonar.api.resources.File; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.Resource; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.RulePriority; -import org.sonar.batch.scan.measure.MeasureCache; -import org.sonar.core.persistence.AbstractDaoTestCase; - -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 MeasurePersisterTest extends AbstractDaoTestCase { - - @org.junit.Rule - public ExpectedException thrown = ExpectedException.none(); - - private static final String TOO_LONG_FOR_VARCHAR_4000 = StringUtils.repeat("0123456789", 401); - - public static final int PROJECT_SNAPSHOT_ID = 3001; - public static final int PACKAGE_SNAPSHOT_ID = 3002; - public static final int FILE_SNAPSHOT_ID = 3003; - public static final int COVERAGE_METRIC_ID = 2; - - MeasurePersister measurePersister; - RuleFinder ruleFinder = mock(RuleFinder.class); - Project project = new Project("foo"); - Directory aDirectory = Directory.create("org/foo"); - File aFile = File.create("org/foo/Bar.java"); - BatchResource projectResource = batchResource(project, PROJECT_SNAPSHOT_ID); - BatchResource dirResource = batchResource(aDirectory, PACKAGE_SNAPSHOT_ID); - BatchResource fileResource = batchResource(aFile, FILE_SNAPSHOT_ID); - MeasureCache measureCache; - - @Before - public void mockResourcePersister() { - measureCache = mock(MeasureCache.class); - ResourceCache resourceCache = mock(ResourceCache.class); - when(resourceCache.get("foo")).thenReturn(projectResource); - when(resourceCache.get("foo:org/foo/Bar.java")).thenReturn(fileResource); - when(resourceCache.get("foo:org/foo")).thenReturn(dirResource); - - MetricFinder metricFinder = mock(MetricFinder.class); - Metric ncloc = ncloc(); - Metric coverage = coverage(); - when(metricFinder.findByKey(ncloc.getKey())).thenReturn(ncloc); - when(metricFinder.findByKey(coverage.getKey())).thenReturn(coverage); - - measurePersister = new MeasurePersister(getMyBatis(), ruleFinder, metricFinder, measureCache, resourceCache); - } - - @Test - public void should_insert_measure() { - setupData("empty"); - - Measure measure = new Measure(ncloc()).setValue(1234.0); - when(measureCache.entries()).thenReturn(Arrays.asList(new Cache.Entry<Measure>(new String[] {"foo", "ncloc"}, measure))); - measurePersister.persist(); - - checkTables("shouldInsertMeasure", "project_measures"); - } - - @Test - public void should_display_message_when_error_during_insert_measure() { - setupData("empty"); - - Measure measure = new Measure(ncloc()).setValue(1234.0).setAlertText(TOO_LONG_FOR_VARCHAR_4000); - when(measureCache.entries()).thenReturn(Arrays.asList(new Cache.Entry<Measure>(new String[] {"foo", "ncloc"}, measure))); - - thrown.expect(IllegalStateException.class); - thrown.expectMessage("Unable to save some measures"); - - measurePersister.persist(); - } - - @Test - public void should_insert_rule_measure() { - setupData("empty"); - - Rule rule = Rule.create("pmd", "key"); - when(ruleFinder.findByKey(rule.ruleKey())).thenReturn(rule); - - Measure measure = new RuleMeasure(ncloc(), rule, RulePriority.MAJOR, 1).setValue(1234.0); - when(measureCache.entries()).thenReturn(Arrays.asList(new Cache.Entry<Measure>(new String[] {"foo", "ncloc"}, measure))); - - measurePersister.persist(); - - checkTables("shouldInsertRuleMeasure", "project_measures"); - } - - @Test - public void should_insert_measure_with_text_data() { - setupData("empty"); - - Measure withLargeData = new Measure(ncloc()).setData(TOO_LONG_FOR_VARCHAR_4000); - when(measureCache.entries()).thenReturn(Arrays.asList(new Cache.Entry<Measure>(new String[] {"foo", "ncloc"}, withLargeData))); - - measurePersister.persist(); - - checkTables("shouldInsertMeasureWithLargeData", "project_measures"); - } - - @Test - public void should_not_save_best_values() { - setupData("empty"); - - Measure measure = new Measure(coverage()).setValue(100.0); - when(measureCache.entries()).thenReturn(Arrays.asList(new Cache.Entry<Measure>(new String[] {"foo:org/foo/Bar.java", "coverage"}, measure))); - - measurePersister.persist(); - - assertEmptyTables("project_measures"); - } - - @Test - public void should_not_save_memory_only_measures() { - setupData("empty"); - - Measure measure = new Measure("ncloc").setPersistenceMode(PersistenceMode.MEMORY); - when(measureCache.entries()).thenReturn(Arrays.asList(new Cache.Entry<Measure>(new String[] {"foo:org/foo/Bar.java", "ncloc"}, measure))); - - measurePersister.persist(); - - assertEmptyTables("project_measures"); - } - - @Test - public void should_always_save_non_file_measures() { - setupData("empty"); - - Measure measure1 = new Measure(ncloc()).setValue(200.0); - Measure measure2 = new Measure(ncloc()).setValue(300.0); - when(measureCache.entries()).thenReturn(Arrays.asList( - new Cache.Entry<Measure>(new String[] {"foo", "ncloc"}, measure1), - new Cache.Entry<Measure>(new String[] {"foo:org/foo", "ncloc"}, measure2))); - - measurePersister.persist(); - - checkTables("shouldAlwaysPersistNonFileMeasures", "project_measures"); - } - - @Test - public void should_not_save_some_file_measures_with_best_value() { - assertThat(MeasurePersister.shouldPersistMeasure(aFile, new Measure(CoreMetrics.LINES, 200.0))).isTrue(); - assertThat(MeasurePersister.shouldPersistMeasure(aFile, new Measure(CoreMetrics.DUPLICATED_LINES_DENSITY, 3.0))).isTrue(); - - Measure duplicatedLines = new Measure(CoreMetrics.DUPLICATED_LINES_DENSITY, 0.0); - assertThat(MeasurePersister.shouldPersistMeasure(aFile, duplicatedLines)).isFalse(); - - duplicatedLines.setVariation1(0.0); - assertThat(MeasurePersister.shouldPersistMeasure(aFile, duplicatedLines)).isFalse(); - - duplicatedLines.setVariation1(-3.0); - assertThat(MeasurePersister.shouldPersistMeasure(aFile, duplicatedLines)).isTrue(); - } - - @Test - public void should_not_save_measures_without_data() { - assertThat(MeasurePersister.shouldPersistMeasure(aFile, new Measure(CoreMetrics.LINES))).isFalse(); - - Measure duplicatedLines = new Measure(CoreMetrics.DUPLICATED_LINES_DENSITY); - assertThat(MeasurePersister.shouldPersistMeasure(aFile, duplicatedLines)).isFalse(); - } - - private static BatchResource batchResource(Resource resource, int id) { - Snapshot snapshot = mock(Snapshot.class); - when(snapshot.getId()).thenReturn(id); - return new BatchResource(1, resource, null).setSnapshot(snapshot); - } - - private static Metric ncloc() { - Metric ncloc = mock(Metric.class); - when(ncloc.getId()).thenReturn(1); - when(ncloc.getKey()).thenReturn("ncloc"); - return ncloc; - } - - private static Metric coverage() { - Metric coverage = mock(Metric.class); - when(coverage.getId()).thenReturn(COVERAGE_METRIC_ID); - when(coverage.getKey()).thenReturn("coverage"); - when(coverage.isOptimizedBestValue()).thenReturn(true); - when(coverage.getBestValue()).thenReturn(100.0); - return coverage; - } -} diff --git a/sonar-batch/src/test/java/org/sonar/batch/phases/DatabaseModePhaseExecutorTest.java b/sonar-batch/src/test/java/org/sonar/batch/phases/DatabaseModePhaseExecutorTest.java deleted file mode 100644 index 57e72f0ed40..00000000000 --- a/sonar-batch/src/test/java/org/sonar/batch/phases/DatabaseModePhaseExecutorTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.batch.phases; - -import org.junit.Test; -import org.sonar.batch.index.MeasurePersister; -import org.sonar.batch.index.ResourcePersister; -import org.sonar.batch.index.ScanPersister; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -public class DatabaseModePhaseExecutorTest { - - @Test - public void shouldSortPersisters() { - ScanPersister otherPersister = mock(ScanPersister.class); - MeasurePersister measurePersister = new MeasurePersister(null, null, null, null, null); - ResourcePersister resourcePersister = new ResourcePersister(null, null, null, null, null); - ScanPersister[] persisters = new ScanPersister[] {otherPersister, measurePersister, resourcePersister}; - DatabaseModePhaseExecutor executor = new DatabaseModePhaseExecutor(null, null, null, null, null, - null, null, null, null, null, persisters, null, null, null, null, null, null, null, null); - assertThat(executor.sortedPersisters()).containsSubsequence(resourcePersister, measurePersister); - - persisters = new ScanPersister[] {measurePersister, resourcePersister, otherPersister}; - executor = new DatabaseModePhaseExecutor(null, null, null, null, null, - null, null, null, null, null, persisters, null, null, null, null, null, null, null, null); - assertThat(executor.sortedPersisters()).containsSubsequence(resourcePersister, measurePersister); - - persisters = new ScanPersister[] {measurePersister, otherPersister, resourcePersister}; - executor = new DatabaseModePhaseExecutor(null, null, null, null, null, - null, null, null, null, null, persisters, null, null, null, null, null, null, null, null); - assertThat(executor.sortedPersisters()).containsSubsequence(resourcePersister, measurePersister); - } - -} diff --git a/sonar-batch/src/test/java/org/sonar/batch/report/MeasuresPublisherTest.java b/sonar-batch/src/test/java/org/sonar/batch/report/MeasuresPublisherTest.java new file mode 100644 index 00000000000..ea8e3462afe --- /dev/null +++ b/sonar-batch/src/test/java/org/sonar/batch/report/MeasuresPublisherTest.java @@ -0,0 +1,163 @@ +/* + * 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.batch.report; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.sonar.api.batch.sensor.duplication.Duplication; +import org.sonar.api.batch.sensor.duplication.internal.DefaultDuplication; +import org.sonar.api.database.model.Snapshot; +import org.sonar.api.measures.*; +import org.sonar.api.measures.Metric.Level; +import org.sonar.api.measures.Metric.ValueType; +import org.sonar.api.resources.Project; +import org.sonar.api.resources.Resource; +import org.sonar.api.rule.RuleKey; +import org.sonar.api.rules.RulePriority; +import org.sonar.api.technicaldebt.batch.Characteristic; +import org.sonar.batch.duplication.DuplicationCache; +import org.sonar.batch.index.ResourceCache; +import org.sonar.batch.protocol.output.BatchReportReader; +import org.sonar.batch.protocol.output.BatchReportWriter; +import org.sonar.batch.scan.measure.MeasureCache; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class MeasuresPublisherTest { + + @Rule + public TemporaryFolder temp = new TemporaryFolder(); + + private MeasureCache measureCache; + private DuplicationCache duplicationCache; + private MeasuresPublisher publisher; + + private org.sonar.api.resources.Resource sampleFile; + + @Before + public void prepare() { + Project p = new Project("foo").setAnalysisDate(new Date(1234567L)); + ResourceCache resourceCache = new ResourceCache(); + sampleFile = org.sonar.api.resources.File.create("src/Foo.php").setEffectiveKey("foo:src/Foo.php"); + resourceCache.add(p, null).setSnapshot(new Snapshot().setId(2)); + resourceCache.add(sampleFile, null); + measureCache = mock(MeasureCache.class); + duplicationCache = mock(DuplicationCache.class); + when(measureCache.byResource(any(Resource.class))).thenReturn(Collections.<Measure>emptyList()); + when(duplicationCache.byComponent(anyString())).thenReturn(Collections.<DefaultDuplication>emptyList()); + publisher = new MeasuresPublisher(resourceCache, measureCache, duplicationCache); + } + + @Test + public void publishMeasures() throws Exception { + + Measure measure1 = new Measure<>(CoreMetrics.COVERAGE) + .setValue(2.0) + .setAlertStatus(Level.ERROR) + .setAlertText("Foo") + .setTendency(-1) + .setCharacteristic(mock(Characteristic.class)); + // No value on new_xxx + Measure measure2 = new Measure<>(CoreMetrics.NEW_BLOCKER_VIOLATIONS) + .setVariation1(1.0) + .setVariation2(2.0) + .setVariation3(3.0) + .setVariation4(4.0) + .setVariation5(5.0); + // Manual measure + Measure manual = new Measure<>(new Metric<>("manual_metric", ValueType.BOOL)) + .setValue(1.0) + .setDescription("Manual"); + // Rule measure + RuleMeasure ruleMeasureBySeverity = RuleMeasure.createForPriority(CoreMetrics.NCLOC, RulePriority.BLOCKER, 1.0); + RuleMeasure ruleMeasureByRule = RuleMeasure.createForRule(CoreMetrics.NCLOC, RuleKey.of("squid", "S12345"), 1.0); + // Sqale rating have both a value and a data + Measure rating = new Measure<>(CoreMetrics.SQALE_RATING) + .setValue(2.0) + .setData("A"); + // Long measure + Measure longMeasure = new Measure<>(CoreMetrics.TECHNICAL_DEBT) + .setValue(1.0); + // String value + Measure stringMeasure = new Measure<>(CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION) + .setData("foo bar"); + + when(measureCache.byResource(sampleFile)).thenReturn(Arrays.asList(measure1, measure2, manual, ruleMeasureBySeverity, ruleMeasureByRule, rating, longMeasure, stringMeasure)); + + File outputDir = temp.newFolder(); + BatchReportWriter writer = new BatchReportWriter(outputDir); + + publisher.publish(writer); + + BatchReportReader reader = new BatchReportReader(outputDir); + + assertThat(reader.readComponentMeasures(1)).hasSize(0); + List<org.sonar.batch.protocol.output.BatchReport.Measure> componentMeasures = reader.readComponentMeasures(2); + assertThat(componentMeasures).hasSize(8); + assertThat(componentMeasures.get(0).getDoubleValue()).isEqualTo(2.0); + assertThat(componentMeasures.get(0).getAlertStatus()).isEqualTo("ERROR"); + assertThat(componentMeasures.get(0).getAlertText()).isEqualTo("Foo"); + + } + + @Test + public void publishMeasureAndDuplication() throws Exception { + + Measure measure1 = new Measure<>(CoreMetrics.COVERAGE) + .setValue(2.0); + + when(measureCache.byResource(sampleFile)).thenReturn(Arrays.asList(measure1)); + DefaultDuplication dup1 = new DefaultDuplication() + .setOriginBlock(new Duplication.Block("foo:src/Foo.php", 1, 10)) + .isDuplicatedBy("foo:src/Foo.php", 20, 50); + DefaultDuplication dup2 = new DefaultDuplication() + .setOriginBlock(new Duplication.Block("foo:src/Foo.php", 1, 10)) + .isDuplicatedBy("another", 20, 50); + when(duplicationCache.byComponent("foo:src/Foo.php")).thenReturn(Arrays.asList(dup1, dup2)); + + File outputDir = temp.newFolder(); + BatchReportWriter writer = new BatchReportWriter(outputDir); + + publisher.publish(writer); + + BatchReportReader reader = new BatchReportReader(outputDir); + + assertThat(reader.readComponentMeasures(1)).hasSize(0); + List<org.sonar.batch.protocol.output.BatchReport.Measure> componentMeasures = reader.readComponentMeasures(2); + assertThat(componentMeasures).hasSize(2); + assertThat(componentMeasures.get(0).getStringValue()) + .isEqualTo( + "<duplications><g><b s=\"1\" l=\"10\" r=\"foo:src/Foo.php\"/><b s=\"20\" l=\"31\" r=\"foo:src/Foo.php\"/></g><g><b s=\"1\" l=\"10\" r=\"foo:src/Foo.php\"/><b s=\"20\" l=\"31\" r=\"another\"/></g></duplications>"); + + } + +} |