aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/test/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-10-17 15:18:15 +0300
committerGravatar Vitaly Takmazov2017-10-17 15:18:15 +0300
commitd16275ecf30c76a913b965a18eb69098f94a5008 (patch)
tree3d1a8107c3d63cce81b1aac6bbfc27ec2695898d /juick-notifications/src/test/java
parentd41e94c835396f5f8b33f8be05dcb76366e06d22 (diff)
notifications: fix test
Diffstat (limited to 'juick-notifications/src/test/java')
-rw-r--r--juick-notifications/src/test/java/com/juick/components/test/NotificationTests.java14
1 files changed, 3 insertions, 11 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 09a0c59a..9ca9c187 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
@@ -23,7 +23,6 @@ import ch.qos.logback.core.Appender;
import com.juick.components.CleanUp;
import com.juick.components.Notifications;
import com.juick.components.service.TokenService;
-import com.notnoop.apns.ApnsService;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -32,6 +31,7 @@ import org.mockito.MockitoAnnotations;
import org.slf4j.LoggerFactory;
import org.springframework.web.client.RestTemplate;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -49,8 +49,6 @@ public class NotificationTests {
CleanUp cleanUp;
@Mock
- ApnsService service;
- @Mock
RestTemplate rest;
@Mock
TokenService tokenService;
@@ -65,19 +63,13 @@ public class NotificationTests {
@Test
public void CleanUpTest() {
- Map<String, Date> inactiveDevices = new HashMap<>();
- inactiveDevices.put("yoyoyo", new Date());
- when(service.getInactiveDevices()).thenReturn(inactiveDevices);
+ when(push.getInvalidAPNSTokens()).thenReturn(Collections.singleton("yoyo"));
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
final Appender mockAppender = mock(Appender.class);
when(mockAppender.getName()).thenReturn("MOCK");
root.addAppender(mockAppender);
cleanUp.cleanupTokens();
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(argument ->
- ((LoggingEvent)argument).getFormattedMessage().contains("No APNS tokens to delete")));
+ ((LoggingEvent)argument).getFormattedMessage().contains("1 tokens")));
}
}