urbanairship-core/src/test/java/com/urbanairship/remotedata/RemoteDataTest.java
@Test
    public void testHandleRefreshResponse() {
        remoteData.init();

        final Set<RemoteDataPayload> subscribedPayloads = new HashSet<>();

        remoteData.payloadUpdates.subscribe(new Subscriber<Set<RemoteDataPayload>>() {
            @Override
            public void onNext(Set<RemoteDataPayload> payloads) {
                subscribedPayloads.addAll(payloads);
            }
        });

        remoteData.handleRefreshResponse(asSet(payload, otherPayload));
        runLooperTasks();

        Assert.assertEquals(asSet(payload, otherPayload), subscribedPayloads);
        Assert.assertEquals(remoteData.dataStore.getPayloads(), asSet(payload, otherPayload));

        subscribedPayloads.clear();

        // Subsequent refresh response missing previously known types
        remoteData.handleRefreshResponse(asSet(otherPayload));
        runLooperTasks();

        Assert.assertEquals(asSet(otherPayload), subscribedPayloads);

        // "Deleted" payload types should not persist in the cache
        Assert.assertEquals(remoteData.dataStore.getPayloads(), asSet(otherPayload));
    }
/**
     * Test the refresh response callback from the job runner.
     */
Test the refresh response callback from the job runner.
Test the refresh response callback from the job runner .
@Test
    public void testHandleRefreshResponse() {
        remoteData.init();
        final Set<RemoteDataPayload> subscribedPayloads = new HashSet<>();
        remoteData.payloadUpdates.subscribe(new Subscriber<Set<RemoteDataPayload>>() {
            @Override
            public void onNext(Set<RemoteDataPayload> payloads) {
                subscribedPayloads.addAll(payloads);
            }
        });
        remoteData.handleRefreshResponse(asSet(payload, otherPayload));
        runLooperTasks();
        Assert.assertEquals(asSet(payload, otherPayload), subscribedPayloads);
        Assert.assertEquals(remoteData.dataStore.getPayloads(), asSet(payload, otherPayload));
        subscribedPayloads.clear();
        remoteData.handleRefreshResponse(asSet(otherPayload));
        runLooperTasks();
        Assert.assertEquals(asSet(otherPayload), subscribedPayloads);
        Assert.assertEquals(remoteData.dataStore.getPayloads(), asSet(otherPayload));
    }
@ Test public void testHandleRefreshResponse ( ) { remoteData . init ( ) ; final Set < RemoteDataPayload > subscribedPayloads = new HashSet < > ( ) ; remoteData . payloadUpdates . subscribe ( new Subscriber < Set < RemoteDataPayload > > ( ) { @ Override public void onNext ( Set < RemoteDataPayload > payloads ) { subscribedPayloads . addAll ( payloads ) ; } } ) ; remoteData . handleRefreshResponse ( asSet ( payload , otherPayload ) ) ; runLooperTasks ( ) ; Assert . assertEquals ( asSet ( payload , otherPayload ) , subscribedPayloads ) ; Assert . assertEquals ( remoteData . dataStore . getPayloads ( ) , asSet ( payload , otherPayload ) ) ; subscribedPayloads . clear ( ) ; remoteData . handleRefreshResponse ( asSet ( otherPayload ) ) ; runLooperTasks ( ) ; Assert . assertEquals ( asSet ( otherPayload ) , subscribedPayloads ) ; Assert . assertEquals ( remoteData . dataStore . getPayloads ( ) , asSet ( otherPayload ) ) ; }
Test the refresh response callback from the job runner.
Test the refresh response callback from the job runner .
// Subsequent refresh response missing previously known types // "Deleted" payload types should not persist in the cache