aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2018-03-09 14:08:43 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2018-03-12 09:24:23 +0100
commit35749faa8b9f588b3269f3bcf09a776c0889e883 (patch)
tree48ab0b5b81a2d08870359887cbf941d71c46e3b3 /sonar-duplications/src
parentf81bf3c5f5caf93173c53499c13a7e54b60b28f9 (diff)
downloadsonarqube-35749faa8b9f588b3269f3bcf09a776c0889e883.tar.gz
sonarqube-35749faa8b9f588b3269f3bcf09a776c0889e883.zip
Fix some Java compiler warnings
Diffstat (limited to 'sonar-duplications/src')
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java2
-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
4 files changed, 22 insertions, 21 deletions
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
index 8bad1e2119b..6044a20a9f1 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
@@ -32,7 +32,7 @@ public final class TextSet extends AbstractText {
public static final class Builder {
- private List<Object> symbols = new ArrayList();
+ private List<Object> symbols = new ArrayList<>();
private Integer lengthOfOrigin;
private int count;
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;