aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications/src/test/java/org/sonar/duplications
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-duplications/src/test/java/org/sonar/duplications')
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTestCase.java22
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java27
2 files changed, 22 insertions, 27 deletions
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTestCase.java b/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTestCase.java
index 62c2a43cecb..ae30eab8d6e 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTestCase.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTestCase.java
@@ -19,19 +19,15 @@
*/
package org.sonar.duplications.block;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.sameInstance;
-import static org.junit.Assert.assertThat;
+import com.google.common.collect.Lists;
+import org.junit.Test;
+import org.sonar.duplications.statement.Statement;
import java.util.Collections;
import java.util.List;
-import org.junit.Test;
-import org.sonar.duplications.statement.Statement;
-
-import com.google.common.collect.Lists;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.assertThat;
/**
* Any implementation of {@link BlockChunker} should pass these test scenarios.
@@ -91,11 +87,11 @@ public abstract class BlockChunkerTestCase {
List<Block> blocks = chunker.chunk("resource", statements);
assertThat(blocks.size(), is(4));
assertThat(blocks.get(0).getIndexInFile(), is(0));
- assertThat(blocks.get(0).getFirstLineNumber(), is(0));
- assertThat(blocks.get(0).getLastLineNumber(), is(2));
+ assertThat(blocks.get(0).getStartLine(), is(0));
+ assertThat(blocks.get(0).getEndLine(), is(2));
assertThat(blocks.get(1).getIndexInFile(), is(1));
- assertThat(blocks.get(1).getFirstLineNumber(), is(1));
- assertThat(blocks.get(1).getLastLineNumber(), is(3));
+ assertThat(blocks.get(1).getStartLine(), is(1));
+ assertThat(blocks.get(1).getEndLine(), is(3));
}
@Test
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java
index de9cd11a0f3..393b83462d3 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java
@@ -19,12 +19,7 @@
*/
package org.sonar.duplications.java;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Collection;
-import java.util.List;
-
+import com.google.common.base.Joiner;
import org.junit.Test;
import org.sonar.duplications.block.Block;
import org.sonar.duplications.block.BlockChunker;
@@ -37,7 +32,11 @@ import org.sonar.duplications.statement.Statement;
import org.sonar.duplications.statement.StatementChunker;
import org.sonar.duplications.token.TokenChunker;
-import com.google.common.base.Joiner;
+import java.util.Collection;
+import java.util.List;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
/**
* From <a href="http://research.cs.queensu.ca/TechReports/Reports/2007-541.pdf">A Survey on Software Clone Detection Research (2007 year)</a>:
@@ -71,13 +70,13 @@ public class JavaDuplicationsFunctionalTest {
List<CloneGroup> duplications = detect2(fragment0, fragment1);
assertThat(duplications.size(), is(1));
ClonePart part = duplications.get(0).getOriginPart();
- assertThat(part.getLineStart(), is(1));
- assertThat(part.getLineEnd(), is(5));
+ assertThat(part.getStartLine(), is(1));
+ assertThat(part.getEndLine(), is(5));
}
/**
* Supports only subset of Type 2.
- *
+ *
* @see #type2
* @see #literalsNormalization()
*/
@@ -98,8 +97,8 @@ public class JavaDuplicationsFunctionalTest {
List<CloneGroup> duplications = detect2(fragment0, fragment1);
assertThat(duplications.size(), is(1));
ClonePart part = duplications.get(0).getOriginPart();
- assertThat(part.getLineStart(), is(1));
- assertThat(part.getLineEnd(), is(5));
+ assertThat(part.getStartLine(), is(1));
+ assertThat(part.getEndLine(), is(5));
}
@Test
@@ -146,8 +145,8 @@ public class JavaDuplicationsFunctionalTest {
List<CloneGroup> duplications = detect2(fragment0, fragment1);
assertThat(duplications.size(), is(1));
ClonePart part = duplications.get(0).getOriginPart();
- assertThat(part.getLineStart(), is(3));
- assertThat(part.getLineEnd(), is(6));
+ assertThat(part.getStartLine(), is(3));
+ assertThat(part.getEndLine(), is(6));
}
private String source(String... lines) {