aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-02-01 13:30:23 +0300
committerGravatar Vitaly Takmazov2017-02-01 13:30:23 +0300
commit836f39dc469d953d747fa38e21562441517db3ba (patch)
tree50b54d3a24a50743259c8fb4ef576d228ce6f7bd
parentccd70032ce571875ab7918a44f3ff1752c94a447 (diff)
clean up some warnings
-rw-r--r--juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java19
-rw-r--r--juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java4
2 files changed, 7 insertions, 16 deletions
diff --git a/juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java b/juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java
index 8aac9501..454b43ba 100644
--- a/juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java
+++ b/juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java
@@ -9,7 +9,6 @@ import com.juick.components.service.TokenService;
import com.notnoop.apns.ApnsService;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.ArgumentMatcher;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -20,7 +19,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
-import static org.mockito.Matchers.argThat;
+import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -57,19 +56,11 @@ public class NotificationTests {
when(mockAppender.getName()).thenReturn("MOCK");
root.addAppender(mockAppender);
cleanUp.cleanupTokens();
- verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
- @Override
- public boolean matches(final Object argument) {
- return ((LoggingEvent)argument).getFormattedMessage().contains("1 tokens to delete");
- }
- }));
+ verify(mockAppender).doAppend(argThat(argument ->
+ ((LoggingEvent)argument).getFormattedMessage().contains("1 tokens to delete")));
when(service.getInactiveDevices()).thenReturn(new HashMap<>());
cleanUp.cleanupTokens();
- verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
- @Override
- public boolean matches(final Object argument) {
- return ((LoggingEvent)argument).getFormattedMessage().contains("No APNS tokens to delete");
- }
- }));
+ verify(mockAppender).doAppend(argThat(argument ->
+ ((LoggingEvent)argument).getFormattedMessage().contains("No APNS tokens to delete")));
}
}
diff --git a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
index 23223c0e..2b69ea7d 100644
--- a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
+++ b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
@@ -7,7 +7,6 @@ import com.juick.server.protocol.ProtocolListener;
import com.juick.service.MessagesService;
import com.juick.service.SubscriptionService;
import com.juick.service.UserService;
-import org.apache.commons.lang3.CharEncoding;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.http.NameValuePair;
@@ -27,6 +26,7 @@ import javax.inject.Inject;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -65,7 +65,7 @@ public class WebsocketComponent extends TextWebSocketHandler implements Protocol
// Auth
User visitor = new User();
- List<NameValuePair> params = URLEncodedUtils.parse(hLocation, CharEncoding.UTF_8);
+ List<NameValuePair> params = URLEncodedUtils.parse(hLocation, StandardCharsets.UTF_8);
for (NameValuePair param : params) {
if (param.getName().equals("hash")) {
String hash = param.getValue();