aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'juick-notifications/src/test/java/com')
-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")));
}
}