if (source.getTopicStates() != null) { List<TopicState> states = new ArrayList<TopicState>(source.getTopicStates().size()); for (org.kaaproject.kaa.common.endpoint.gen.TopicState state : source.getTopicStates()) { states.add(new TopicState(state.getTopicId(), state.getSeqNumber()));
@Test public void testTopicState() { KaaClientState clientState = Mockito.mock(KaaClientState.class); Map<Long, Integer> nfSubscriptions = new HashMap<>(); nfSubscriptions.put(1l, 10); nfSubscriptions.put(2l, 3); Mockito.when(clientState.getNfSubscriptions()).thenReturn(nfSubscriptions); NotificationTransport transport = new DefaultNotificationTransport(); Assert.assertNull(transport.createEmptyNotificationRequest()); transport.setClientState(clientState); NotificationSyncRequest request = transport.createEmptyNotificationRequest(); Assert.assertTrue(request.getTopicStates().size() == 2); } }