aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-duplications/src/test')
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelDisptacherTest.java25
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementChannelTest.java14
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/matcher/ForgetLastTokenMatcherTest.java2
3 files changed, 21 insertions, 20 deletions
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 0b712f119cf..e2c514dd37b 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,31 +19,30 @@
*/
package org.sonar.duplications.statement;
+import java.util.List;
+import org.junit.Test;
+import org.sonar.duplications.statement.matcher.TokenMatcher;
+import org.sonar.duplications.token.Token;
+import org.sonar.duplications.token.TokenQueue;
+
+import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyListOf;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Test;
-import org.sonar.duplications.statement.matcher.TokenMatcher;
-import org.sonar.duplications.token.Token;
-import org.sonar.duplications.token.TokenQueue;
-
public class StatementChannelDisptacherTest {
@Test(expected = IllegalStateException.class)
public void shouldThrowAnException() {
TokenMatcher tokenMatcher = mock(TokenMatcher.class);
StatementChannel channel = StatementChannel.create(tokenMatcher);
- StatementChannelDisptacher dispatcher = new StatementChannelDisptacher(Arrays.asList(channel));
+ StatementChannelDisptacher dispatcher = new StatementChannelDisptacher(asList(channel));
TokenQueue tokenQueue = mock(TokenQueue.class);
when(tokenQueue.peek()).thenReturn(new Token("a", 1, 0)).thenReturn(null);
List<Statement> statements = mock(List.class);
@@ -54,9 +53,9 @@ public class StatementChannelDisptacherTest {
@Test
public void shouldConsume() {
TokenMatcher tokenMatcher = mock(TokenMatcher.class);
- when(tokenMatcher.matchToken(any(TokenQueue.class), anyListOf(Token.class))).thenReturn(true);
+ when(tokenMatcher.matchToken(any(TokenQueue.class), anyList())).thenReturn(true);
StatementChannel channel = StatementChannel.create(tokenMatcher);
- StatementChannelDisptacher dispatcher = new StatementChannelDisptacher(Arrays.asList(channel));
+ StatementChannelDisptacher dispatcher = new StatementChannelDisptacher(asList(channel));
TokenQueue tokenQueue = mock(TokenQueue.class);
when(tokenQueue.peek()).thenReturn(new Token("a", 1, 0)).thenReturn(null);
List<Statement> statements = mock(List.class);
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 f1b1aa3f976..361ebcc43c1 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
@@ -23,7 +23,6 @@ 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;
@@ -31,6 +30,9 @@ import org.sonar.duplications.token.TokenQueue;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -45,7 +47,7 @@ public class StatementChannelTest {
@Test(expected = IllegalArgumentException.class)
public void shouldNotAcceptEmpty() {
- StatementChannel.create(new TokenMatcher[] {});
+ StatementChannel.create(new TokenMatcher[]{});
}
@Test
@@ -57,7 +59,7 @@ public class StatementChannelTest {
assertThat(channel.consume(tokenQueue, output), is(false));
ArgumentCaptor<List> matchedTokenList = ArgumentCaptor.forClass(List.class);
- verify(matcher).matchToken(Matchers.eq(tokenQueue), matchedTokenList.capture());
+ verify(matcher).matchToken(eq(tokenQueue), matchedTokenList.capture());
verifyNoMoreInteractions(matcher);
verify(tokenQueue).pushForward(matchedTokenList.getValue());
verifyNoMoreInteractions(tokenQueue);
@@ -73,7 +75,7 @@ public class StatementChannelTest {
List<Statement> output = mock(List.class);
assertThat(channel.consume(tokenQueue, output), is(true));
- verify(matcher).matchToken(Matchers.eq(tokenQueue), Matchers.anyList());
+ verify(matcher).matchToken(eq(tokenQueue), anyList());
verifyNoMoreInteractions(matcher);
ArgumentCaptor<Statement> statement = ArgumentCaptor.forClass(Statement.class);
verify(output).add(statement.capture());
@@ -91,9 +93,9 @@ public class StatementChannelTest {
List<Statement> output = mock(List.class);
assertThat(channel.consume(tokenQueue, output), is(true));
- verify(matcher).matchToken(Matchers.eq(tokenQueue), Matchers.anyList());
+ verify(matcher).matchToken(eq(tokenQueue), anyList());
verifyNoMoreInteractions(matcher);
- verify(output).add(Matchers.any(Statement.class));
+ verify(output).add(any());
verifyNoMoreInteractions(output);
}
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 ee296272c38..e2996280aed 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
@@ -29,7 +29,7 @@ import org.sonar.duplications.token.TokenQueue;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;