aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-11-23 22:01:21 +0100
committerGitHub <noreply@github.com>2017-11-23 22:01:21 +0100
commit4eb8c7f8657ebe5544fcd2283145d175713ab567 (patch)
treedd9e4078d15e052578874234bbb3761e20a448e4 /sonar-duplications
parente02d9d4a80eeb4f5cff53dd057e86df2c48d4f7e (diff)
downloadsonarqube-4eb8c7f8657ebe5544fcd2283145d175713ab567.tar.gz
sonarqube-4eb8c7f8657ebe5544fcd2283145d175713ab567.zip
Support build of SonarQube with JDK 9
Diffstat (limited to 'sonar-duplications')
-rw-r--r--sonar-duplications/pom.xml5
-rw-r--r--sonar-duplications/src/test/java/net/sourceforge/pmd/cpd/TokenEntryTest.java4
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTest.java9
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTestCase.java8
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java4
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/block/ByteArrayTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/detector/ContainsInComparatorTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/detector/DetectorTestCase.java4
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/detector/original/FilterTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithmTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java4
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/index/PackedMemoryCloneIndexTest.java4
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/PmdBlockChunkerTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/java/JavaTokenProducerTest.java270
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelDisptacherTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelTest.java18
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/TokenMatcherFactoryTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/AnyTokenMatcherTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/BridgeTokenMatcherTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ExactTokenMatcherTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ForgetLastTokenMatcherTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/OptTokenMatcherTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/UptoTokenMatcherTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java4
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/utils/SortedListsUtilsTest.java2
-rw-r--r--sonar-duplications/test-resources/org/sonar/duplications/cpd/CPDTest/CPDFile3.java4
33 files changed, 185 insertions, 195 deletions
diff --git a/sonar-duplications/pom.xml b/sonar-duplications/pom.xml
index 8d41b5acb8c..67ab7cc8488 100644
--- a/sonar-duplications/pom.xml
+++ b/sonar-duplications/pom.xml
@@ -39,11 +39,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
diff --git a/sonar-duplications/src/test/java/net/sourceforge/pmd/cpd/TokenEntryTest.java b/sonar-duplications/src/test/java/net/sourceforge/pmd/cpd/TokenEntryTest.java
index 950da090b89..2d22ef7c6cb 100644
--- a/sonar-duplications/src/test/java/net/sourceforge/pmd/cpd/TokenEntryTest.java
+++ b/sonar-duplications/src/test/java/net/sourceforge/pmd/cpd/TokenEntryTest.java
@@ -22,8 +22,8 @@ package net.sourceforge.pmd.cpd;
import org.junit.Before;
import org.junit.Test;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.sameInstance;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertThat;
public class TokenEntryTest {
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTest.java
index 41dd7677a2e..27fbc510958 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockChunkerTest.java
@@ -19,15 +19,14 @@
*/
package org.sonar.duplications.block;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
import java.util.List;
-
import org.junit.Test;
import org.sonar.duplications.statement.Statement;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
public class BlockChunkerTest extends BlockChunkerTestCase {
@Override
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 86716386be7..9dfbb5eead6 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
@@ -25,10 +25,10 @@ import java.util.List;
import org.junit.Test;
import org.sonar.duplications.statement.Statement;
-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.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertThat;
/**
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java
index 2d4a09573f6..135dfad77f1 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/block/BlockTest.java
@@ -21,8 +21,8 @@ package org.sonar.duplications.block;
import org.junit.Test;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.sameInstance;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertThat;
public class BlockTest {
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/block/ByteArrayTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/block/ByteArrayTest.java
index c0844194124..eae430e7071 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/block/ByteArrayTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/block/ByteArrayTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.block;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java
index 499f5ede79c..3a58e443968 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java
@@ -25,7 +25,7 @@ import org.hamcrest.TypeSafeMatcher;
import org.sonar.duplications.index.CloneGroup;
import org.sonar.duplications.index.ClonePart;
-import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.CoreMatchers.hasItem;
public class CloneGroupMatcher extends TypeSafeMatcher<CloneGroup> {
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/ContainsInComparatorTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/ContainsInComparatorTest.java
index c025a7ca2e7..ae2de81d325 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/ContainsInComparatorTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/ContainsInComparatorTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.detector;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import java.util.Comparator;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/DetectorTestCase.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/DetectorTestCase.java
index ee3e8b32232..dc3e9bdfc2a 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/DetectorTestCase.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/DetectorTestCase.java
@@ -34,8 +34,8 @@ import org.sonar.duplications.index.MemoryCloneIndex;
import org.sonar.duplications.junit.TestNamePrinter;
import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.sameInstance;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.spy;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java
index 68998fa8792..cee36b4620b 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java
@@ -22,7 +22,7 @@ package org.sonar.duplications.detector.original;
import org.junit.Test;
import org.sonar.duplications.block.Block;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class BlocksGroupTest {
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/FilterTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/FilterTest.java
index 4b9af7f5c81..868bd4254c1 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/FilterTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/FilterTest.java
@@ -25,7 +25,7 @@ import org.sonar.duplications.index.ClonePart;
import java.util.Arrays;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.*;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithmTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithmTest.java
index 034a980b203..ff68df361e0 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithmTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithmTest.java
@@ -30,7 +30,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import static org.hamcrest.Matchers.sameInstance;
+import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.sonar.duplications.detector.CloneGroupMatcher.hasCloneGroup;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java
index c73de4abe9e..1b6fd0285fe 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java
@@ -19,8 +19,8 @@
*/
package org.sonar.duplications.index;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.Arrays;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/index/PackedMemoryCloneIndexTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/index/PackedMemoryCloneIndexTest.java
index a96823135a4..08d33c791e0 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/index/PackedMemoryCloneIndexTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/index/PackedMemoryCloneIndexTest.java
@@ -30,8 +30,8 @@ import java.util.Collection;
import java.util.Iterator;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.sameInstance;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertThat;
public class PackedMemoryCloneIndexTest {
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/PmdBlockChunkerTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/PmdBlockChunkerTest.java
index f2cf7746e86..a60c7b42373 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/PmdBlockChunkerTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/PmdBlockChunkerTest.java
@@ -26,7 +26,7 @@ import org.sonar.duplications.block.ByteArray;
import java.util.Arrays;
import java.util.List;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class PmdBlockChunkerTest {
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java
index f21a8195a83..db0c4929916 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java
@@ -31,7 +31,7 @@ import net.sourceforge.pmd.cpd.Tokens;
import org.junit.Before;
import org.junit.Test;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class TokenizerBridgeTest {
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 4f02f68ba83..3bfd9dbaa05 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
@@ -35,7 +35,7 @@ import org.sonar.duplications.token.TokenChunker;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.joining;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaTokenProducerTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaTokenProducerTest.java
index 3ee629b73f9..8b309de4773 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaTokenProducerTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaTokenProducerTest.java
@@ -26,22 +26,20 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.apache.commons.io.IOUtils;
-import org.hamcrest.Matcher;
-import org.hamcrest.Matchers;
import org.junit.Test;
import org.sonar.duplications.DuplicationsTestUtil;
import org.sonar.duplications.token.Token;
import org.sonar.duplications.token.TokenChunker;
import org.sonar.duplications.token.TokenQueue;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
public class JavaTokenProducerTest {
+ private static final Token NUMERIC_LITTERAL = new Token("$NUMBER", 1, 0);
+ private static final Token STRING_LITTERAL = new Token("$CHARS", 1, 0);
private final TokenChunker chunker = JavaTokenProducer.build();
/**
@@ -49,7 +47,7 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldIgnoreWhitespaces() {
- assertThat(chunk(" \t\f\n\r"), isTokens());
+ assertThat(chunk(" \t\f\n\r")).isEmpty();
}
/**
@@ -57,15 +55,15 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldIgnoreEndOfLineComment() {
- assertThat(chunk("// This is a comment"), isTokens());
- assertThat(chunk("// This is a comment \n and_this_is_not"), isTokens(new Token("and_this_is_not", 2, 1)));
+ assertThat(chunk("// This is a comment")).isEmpty();
+ assertThat(chunk("// This is a comment \n and_this_is_not")).containsExactly(new Token("and_this_is_not", 2, 1));
}
@Test
public void shouldIgnoreTraditionalComment() {
- assertThat(chunk("/* This is a comment \n and the second line */"), isTokens());
- assertThat(chunk("/** This is a javadoc \n and the second line */"), isTokens());
- assertThat(chunk("/* this \n comment /* \n // /** ends \n here: */"), isTokens());
+ assertThat(chunk("/* This is a comment \n and the second line */")).isEmpty();
+ assertThat(chunk("/** This is a javadoc \n and the second line */")).isEmpty();
+ assertThat(chunk("/* this \n comment /* \n // /** ends \n here: */")).isEmpty();
}
/**
@@ -73,23 +71,24 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldPreserveIdentifiers() {
- assertThat(chunk("String"), isTokens(new Token("String", 1, 0)));
- assertThat(chunk("i3"), isTokens(new Token("i3", 1, 0)));
- assertThat(chunk("MAX_VALUE"), isTokens(new Token("MAX_VALUE", 1, 0)));
- assertThat(chunk("isLetterOrDigit"), isTokens(new Token("isLetterOrDigit", 1, 0)));
+ assertThat(chunk("String")).containsExactly(new Token("String", 1, 0));
+ assertThat(chunk("i3")).containsExactly(new Token("i3", 1, 0));
+ assertThat(chunk("MAX_VALUE")).containsExactly(new Token("MAX_VALUE", 1, 0));
+ assertThat(chunk("isLetterOrDigit")).containsExactly(new Token("isLetterOrDigit", 1, 0));
- assertThat(chunk("_"), isTokens(new Token("_", 1, 0)));
- assertThat(chunk("_123_"), isTokens(new Token("_123_", 1, 0)));
- assertThat(chunk("_Field"), isTokens(new Token("_Field", 1, 0)));
- assertThat(chunk("_Field5"), isTokens(new Token("_Field5", 1, 0)));
+ assertThat(chunk("_")).containsExactly(new Token("_", 1, 0));
+ assertThat(chunk("_123_")).containsExactly(new Token("_123_", 1, 0));
+ assertThat(chunk("_Field")).containsExactly(new Token("_Field", 1, 0));
+ assertThat(chunk("_Field5")).containsExactly(new Token("_Field5", 1, 0));
- assertThat(chunk("$"), isTokens(new Token("$", 1, 0)));
- assertThat(chunk("$field"), isTokens(new Token("$field", 1, 0)));
+ assertThat(chunk("$")).containsExactly(new Token("$", 1, 0));
+ assertThat(chunk("$field")).containsExactly(new Token("$field", 1, 0));
- assertThat(chunk("i2j"), isTokens(new Token("i2j", 1, 0)));
- assertThat(chunk("from1to4"), isTokens(new Token("from1to4", 1, 0)));
+ assertThat(chunk("i2j")).containsExactly(new Token("i2j", 1, 0));
+ assertThat(chunk("from1to4")).containsExactly(new Token("from1to4", 1, 0));
- assertThat("identifier with unicode", chunk("αβγ"), isTokens(new Token("αβγ", 1, 0)));
+ // identifier with unicode
+ assertThat(chunk("αβγ")).containsExactly(new Token("αβγ", 1, 0));
}
/**
@@ -97,7 +96,10 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldPreserverKeywords() {
- assertThat(chunk("private static final"), isTokens(new Token("private", 1, 0), new Token("static", 1, 8), new Token("final", 1, 15)));
+ assertThat(chunk("private static final")).containsExactly(
+ new Token("private", 1, 0),
+ new Token("static", 1, 8),
+ new Token("final", 1, 15));
}
/**
@@ -105,27 +107,27 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldNormalizeDecimalIntegerLiteral() {
- assertThat(chunk("543"), isNumericLiteral());
- assertThat(chunk("543l"), isNumericLiteral());
- assertThat(chunk("543L"), isNumericLiteral());
+ assertThat(chunk("543")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("543l")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("543L")).containsExactly(NUMERIC_LITTERAL);
}
@Test
public void shouldNormalizeOctalIntegerLiteral() {
- assertThat(chunk("077"), isNumericLiteral());
- assertThat(chunk("077l"), isNumericLiteral());
- assertThat(chunk("077L"), isNumericLiteral());
+ assertThat(chunk("077")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("077l")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("077L")).containsExactly(NUMERIC_LITTERAL);
}
@Test
public void shouldNormalizeHexIntegerLiteral() {
- assertThat(chunk("0xFF"), isNumericLiteral());
- assertThat(chunk("0xFFl"), isNumericLiteral());
- assertThat(chunk("0xFFL"), isNumericLiteral());
+ assertThat(chunk("0xFF")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xFFl")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xFFL")).containsExactly(NUMERIC_LITTERAL);
- assertThat(chunk("0XFF"), isNumericLiteral());
- assertThat(chunk("0XFFl"), isNumericLiteral());
- assertThat(chunk("0XFFL"), isNumericLiteral());
+ assertThat(chunk("0XFF")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XFFl")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XFFL")).containsExactly(NUMERIC_LITTERAL);
}
/**
@@ -133,13 +135,13 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldNormalizeBinaryIntegerLiteral() {
- assertThat(chunk("0b10"), isNumericLiteral());
- assertThat(chunk("0b10l"), isNumericLiteral());
- assertThat(chunk("0b10L"), isNumericLiteral());
+ assertThat(chunk("0b10")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0b10l")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0b10L")).containsExactly(NUMERIC_LITTERAL);
- assertThat(chunk("0B10"), isNumericLiteral());
- assertThat(chunk("0B10l"), isNumericLiteral());
- assertThat(chunk("0B10L"), isNumericLiteral());
+ assertThat(chunk("0B10")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0B10l")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0B10L")).containsExactly(NUMERIC_LITTERAL);
}
/**
@@ -148,72 +150,72 @@ public class JavaTokenProducerTest {
@Test
public void shouldNormalizeDecimalFloatingPointLiteral() {
// with dot at the end
- assertThat(chunk("1234."), isNumericLiteral());
- assertThat(chunk("1234.E1"), isNumericLiteral());
- assertThat(chunk("1234.e+1"), isNumericLiteral());
- assertThat(chunk("1234.E-1"), isNumericLiteral());
- assertThat(chunk("1234.f"), isNumericLiteral());
+ assertThat(chunk("1234.")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1234.E1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1234.e+1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1234.E-1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1234.f")).containsExactly(NUMERIC_LITTERAL);
// with dot between
- assertThat(chunk("12.34"), isNumericLiteral());
- assertThat(chunk("12.34E1"), isNumericLiteral());
- assertThat(chunk("12.34e+1"), isNumericLiteral());
- assertThat(chunk("12.34E-1"), isNumericLiteral());
+ assertThat(chunk("12.34")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("12.34E1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("12.34e+1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("12.34E-1")).containsExactly(NUMERIC_LITTERAL);
- assertThat(chunk("12.34f"), isNumericLiteral());
- assertThat(chunk("12.34E1F"), isNumericLiteral());
- assertThat(chunk("12.34E+1d"), isNumericLiteral());
- assertThat(chunk("12.34e-1D"), isNumericLiteral());
+ assertThat(chunk("12.34f")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("12.34E1F")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("12.34E+1d")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("12.34e-1D")).containsExactly(NUMERIC_LITTERAL);
// with dot at the beginning
- assertThat(chunk(".1234"), isNumericLiteral());
- assertThat(chunk(".1234e1"), isNumericLiteral());
- assertThat(chunk(".1234E+1"), isNumericLiteral());
- assertThat(chunk(".1234E-1"), isNumericLiteral());
+ assertThat(chunk(".1234")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk(".1234e1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk(".1234E+1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk(".1234E-1")).containsExactly(NUMERIC_LITTERAL);
- assertThat(chunk(".1234f"), isNumericLiteral());
- assertThat(chunk(".1234E1F"), isNumericLiteral());
- assertThat(chunk(".1234e+1d"), isNumericLiteral());
- assertThat(chunk(".1234E-1D"), isNumericLiteral());
+ assertThat(chunk(".1234f")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk(".1234E1F")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk(".1234e+1d")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk(".1234E-1D")).containsExactly(NUMERIC_LITTERAL);
// without dot
- assertThat(chunk("1234e1"), isNumericLiteral());
- assertThat(chunk("1234E+1"), isNumericLiteral());
- assertThat(chunk("1234E-1"), isNumericLiteral());
+ assertThat(chunk("1234e1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1234E+1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1234E-1")).containsExactly(NUMERIC_LITTERAL);
- assertThat(chunk("1234E1f"), isNumericLiteral());
- assertThat(chunk("1234e+1d"), isNumericLiteral());
- assertThat(chunk("1234E-1D"), isNumericLiteral());
+ assertThat(chunk("1234E1f")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1234e+1d")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1234E-1D")).containsExactly(NUMERIC_LITTERAL);
}
@Test
public void shouldNormalizeHexadecimalFloatingPointLiteral() {
// with dot at the end
- assertThat(chunk("0xAF."), isNumericLiteral());
- assertThat(chunk("0XAF.P1"), isNumericLiteral());
- assertThat(chunk("0xAF.p+1"), isNumericLiteral());
- assertThat(chunk("0XAF.p-1"), isNumericLiteral());
- assertThat(chunk("0xAF.f"), isNumericLiteral());
+ assertThat(chunk("0xAF.")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XAF.P1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xAF.p+1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XAF.p-1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xAF.f")).containsExactly(NUMERIC_LITTERAL);
// with dot between
- assertThat(chunk("0XAF.BC"), isNumericLiteral());
- assertThat(chunk("0xAF.BCP1"), isNumericLiteral());
- assertThat(chunk("0XAF.BCp+1"), isNumericLiteral());
- assertThat(chunk("0xAF.BCP-1"), isNumericLiteral());
+ assertThat(chunk("0XAF.BC")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xAF.BCP1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XAF.BCp+1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xAF.BCP-1")).containsExactly(NUMERIC_LITTERAL);
- assertThat(chunk("0xAF.BCf"), isNumericLiteral());
- assertThat(chunk("0xAF.BCp1F"), isNumericLiteral());
- assertThat(chunk("0XAF.BCP+1d"), isNumericLiteral());
- assertThat(chunk("0XAF.BCp-1D"), isNumericLiteral());
+ assertThat(chunk("0xAF.BCf")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xAF.BCp1F")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XAF.BCP+1d")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XAF.BCp-1D")).containsExactly(NUMERIC_LITTERAL);
// without dot
- assertThat(chunk("0xAFp1"), isNumericLiteral());
- assertThat(chunk("0XAFp+1"), isNumericLiteral());
- assertThat(chunk("0xAFp-1"), isNumericLiteral());
+ assertThat(chunk("0xAFp1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XAFp+1")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xAFp-1")).containsExactly(NUMERIC_LITTERAL);
- assertThat(chunk("0XAFp1f"), isNumericLiteral());
- assertThat(chunk("0xAFp+1d"), isNumericLiteral());
- assertThat(chunk("0XAFp-1D"), isNumericLiteral());
+ assertThat(chunk("0XAFp1f")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xAFp+1d")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0XAFp-1D")).containsExactly(NUMERIC_LITTERAL);
}
/**
@@ -221,19 +223,19 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldNormalizeNumericLiteralsWithUnderscores() {
- assertThat(chunk("54_3L"), isNumericLiteral());
- assertThat(chunk("07_7L"), isNumericLiteral());
- assertThat(chunk("0b1_0L"), isNumericLiteral());
- assertThat(chunk("0xF_FL"), isNumericLiteral());
-
- assertThat(chunk("1_234."), isNumericLiteral());
- assertThat(chunk("1_2.3_4"), isNumericLiteral());
- assertThat(chunk(".1_234"), isNumericLiteral());
- assertThat(chunk("1_234e1_0"), isNumericLiteral());
-
- assertThat(chunk("0xA_F."), isNumericLiteral());
- assertThat(chunk("0xA_F.B_C"), isNumericLiteral());
- assertThat(chunk("0x1.ffff_ffff_ffff_fP1_023"), isNumericLiteral());
+ assertThat(chunk("54_3L")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("07_7L")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0b1_0L")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xF_FL")).containsExactly(NUMERIC_LITTERAL);
+
+ assertThat(chunk("1_234.")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1_2.3_4")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk(".1_234")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("1_234e1_0")).containsExactly(NUMERIC_LITTERAL);
+
+ assertThat(chunk("0xA_F.")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0xA_F.B_C")).containsExactly(NUMERIC_LITTERAL);
+ assertThat(chunk("0x1.ffff_ffff_ffff_fP1_023")).containsExactly(NUMERIC_LITTERAL);
}
/**
@@ -241,7 +243,7 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldPreserveBooleanLiterals() {
- assertThat(chunk("true false"), isTokens(new Token("true", 1, 0), new Token("false", 1, 5)));
+ assertThat(chunk("true false")).containsExactly(new Token("true", 1, 0), new Token("false", 1, 5));
}
/**
@@ -249,11 +251,16 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldNormalizeCharacterLiterals() {
- assertThat("single character", chunk("'a'"), isStringLiteral());
- assertThat("escaped LF", chunk("'\\n'"), isStringLiteral());
- assertThat("escaped quote", chunk("'\\''"), isStringLiteral());
- assertThat("octal escape", chunk("'\\177'"), isStringLiteral());
- assertThat("unicode escape", chunk("'\\u03a9'"), isStringLiteral());
+ // single character
+ assertThat(chunk("'a'")).containsExactly(STRING_LITTERAL);
+ // escaped LF
+ assertThat(chunk("'\\n'")).containsExactly(STRING_LITTERAL);
+ // escaped quote
+ assertThat(chunk("'\\''")).containsExactly(STRING_LITTERAL);
+ // octal escape
+ assertThat(chunk("'\\177'")).containsExactly(STRING_LITTERAL);
+ // unicode escape
+ assertThat(chunk("'\\u03a9'")).containsExactly(STRING_LITTERAL);
}
/**
@@ -261,12 +268,18 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldNormalizeStringLiterals() {
- assertThat("regular string", chunk("\"string\""), isStringLiteral());
- assertThat("empty string", chunk("\"\""), isStringLiteral());
- assertThat("escaped LF", chunk("\"\\n\""), isStringLiteral());
- assertThat("escaped double quotes", chunk("\"string, which contains \\\"escaped double quotes\\\"\""), isStringLiteral());
- assertThat("octal escape", chunk("\"string \\177\""), isStringLiteral());
- assertThat("unicode escape", chunk("\"string \\u03a9\""), isStringLiteral());
+ // regular string
+ assertThat(chunk("\"string\"")).containsExactly(STRING_LITTERAL);
+ // empty string
+ assertThat(chunk("\"\"")).containsExactly(STRING_LITTERAL);
+ // escaped LF
+ assertThat(chunk("\"\\n\"")).containsExactly(STRING_LITTERAL);
+ // escaped double quotes
+ assertThat(chunk("\"string, which contains \\\"escaped double quotes\\\"\"")).containsExactly(STRING_LITTERAL);
+ // octal escape
+ assertThat(chunk("\"string \\177\"")).containsExactly(STRING_LITTERAL);
+ // unicode escape
+ assertThat(chunk("\"string \\u03a9\"")).containsExactly(STRING_LITTERAL);
}
/**
@@ -274,7 +287,7 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldPreserverNullLiteral() {
- assertThat(chunk("null"), isTokens(new Token("null", 1, 0)));
+ assertThat(chunk("null")).containsExactly(new Token("null", 1, 0));
}
/**
@@ -282,12 +295,12 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldPreserveSeparators() {
- assertThat(chunk("(){}[];,."), isTokens(
+ assertThat(chunk("(){}[];,.")).containsExactly(
new Token("(", 1, 0), new Token(")", 1, 1),
new Token("{", 1, 2), new Token("}", 1, 3),
new Token("[", 1, 4), new Token("]", 1, 5),
new Token(";", 1, 6), new Token(",", 1, 7),
- new Token(".", 1, 8)));
+ new Token(".", 1, 8));
}
/**
@@ -295,17 +308,17 @@ public class JavaTokenProducerTest {
*/
@Test
public void shouldPreserveOperators() {
- assertThat(chunk("+="), isTokens(new Token("+", 1, 0), new Token("=", 1, 1)));
- assertThat(chunk("--"), isTokens(new Token("-", 1, 0), new Token("-", 1, 1)));
+ assertThat(chunk("+=")).containsExactly(new Token("+", 1, 0), new Token("=", 1, 1));
+ assertThat(chunk("--")).containsExactly(new Token("-", 1, 0), new Token("-", 1, 1));
}
@Test
public void realExamples() {
File testFile = DuplicationsTestUtil.findFile("/java/MessageResources.java");
- assertThat(chunk(testFile).size(), Matchers.greaterThan(0));
+ assertThat(chunk(testFile)).isNotEmpty();
testFile = DuplicationsTestUtil.findFile("/java/RequestUtils.java");
- assertThat(chunk(testFile).size(), Matchers.greaterThan(0));
+ assertThat(chunk(testFile)).isNotEmpty();
}
private TokenQueue chunk(File file) {
@@ -320,21 +333,6 @@ public class JavaTokenProducerTest {
}
}
- private static Matcher<List<Token>> isNumericLiteral() {
- return isTokens(new Token("$NUMBER", 1, 0));
- }
-
- private static Matcher<List<Token>> isStringLiteral() {
- return isTokens(new Token("$CHARS", 1, 0));
- }
-
- /**
- * @return matcher for list of tokens
- */
- private static Matcher<List<Token>> isTokens(Token... tokens) {
- return is(Arrays.asList(tokens));
- }
-
private List<Token> chunk(String sourceCode) {
List<Token> target = new ArrayList<>();
chunker.chunk(sourceCode).forEach(target::add);
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelDisptacherTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelDisptacherTest.java
index 0bc99930cfc..b710f2d00a2 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelDisptacherTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelDisptacherTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.statement;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyListOf;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelTest.java
index 4bd873d4810..d44d344445e 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelTest.java
@@ -19,25 +19,23 @@
*/
package org.sonar.duplications.statement;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-
-import org.mockito.Matchers;
-
import java.util.Arrays;
import java.util.List;
-
import org.junit.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Matchers;
import org.sonar.duplications.statement.matcher.AnyTokenMatcher;
import org.sonar.duplications.statement.matcher.TokenMatcher;
import org.sonar.duplications.token.Token;
import org.sonar.duplications.token.TokenQueue;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
public class StatementChannelTest {
@Test(expected = IllegalArgumentException.class)
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java
index 96169310691..6b50fe3a45a 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.statement;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/TokenMatcherFactoryTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/TokenMatcherFactoryTest.java
index 305af7d05d8..e05a24c3b3a 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/TokenMatcherFactoryTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/TokenMatcherFactoryTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.statement;
-import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/AnyTokenMatcherTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/AnyTokenMatcherTest.java
index 5443eba0f73..113928f37bc 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/AnyTokenMatcherTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/AnyTokenMatcherTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.statement.matcher;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/BridgeTokenMatcherTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/BridgeTokenMatcherTest.java
index 89733e0f8ef..32fa219c3cc 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/BridgeTokenMatcherTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/BridgeTokenMatcherTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.statement.matcher;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ExactTokenMatcherTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ExactTokenMatcherTest.java
index 684b67a2f74..bd4687fca2f 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ExactTokenMatcherTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ExactTokenMatcherTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.statement.matcher;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ForgetLastTokenMatcherTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ForgetLastTokenMatcherTest.java
index a0746cbdd4f..30f35404864 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ForgetLastTokenMatcherTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ForgetLastTokenMatcherTest.java
@@ -27,7 +27,7 @@ import org.junit.Test;
import org.sonar.duplications.token.Token;
import org.sonar.duplications.token.TokenQueue;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.spy;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/OptTokenMatcherTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/OptTokenMatcherTest.java
index 9ffc1e0e78a..4d33697782b 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/OptTokenMatcherTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/OptTokenMatcherTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.statement.matcher;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/UptoTokenMatcherTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/UptoTokenMatcherTest.java
index 3e76a1b5b10..2e03a391a42 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/UptoTokenMatcherTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/UptoTokenMatcherTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.statement.matcher;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java
index 08eb2f861d7..0d00b892be2 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenChannelTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.token;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java
index 321235ca1ef..feee54254ca 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.token;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java
index 750cb0c7c5d..0111f0f76f5 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenTest.java
@@ -23,8 +23,8 @@ import org.junit.Test;
import static org.junit.Assert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
public class TokenTest {
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/utils/SortedListsUtilsTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/utils/SortedListsUtilsTest.java
index f1ba9d0cd4e..d7a6f8acf9a 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/utils/SortedListsUtilsTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/utils/SortedListsUtilsTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.duplications.utils;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.Arrays;
diff --git a/sonar-duplications/test-resources/org/sonar/duplications/cpd/CPDTest/CPDFile3.java b/sonar-duplications/test-resources/org/sonar/duplications/cpd/CPDTest/CPDFile3.java
index 8ba22b82a07..1b103c6eec2 100644
--- a/sonar-duplications/test-resources/org/sonar/duplications/cpd/CPDTest/CPDFile3.java
+++ b/sonar-duplications/test-resources/org/sonar/duplications/cpd/CPDTest/CPDFile3.java
@@ -3,8 +3,8 @@
*/
package net.sourceforge.pmd.cpd.fork;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import java.nio.charset.Charset;