urbanairship-core/src/test/java/com/urbanairship/iam/tags/TagGroupLookupApiClientTest.java
@Test
    public void testCachedResponseNewData() {
        // Get a valid response
        TagGroupResponse response = client.lookupTagGroups("some-channel", UAirship.ANDROID_PLATFORM, requestTags, null);

        // Update the response to return new data
        testRequest.response = new Response.Builder(HttpURLConnection.HTTP_OK)
                .setResponseMessage("OK")
                .setResponseBody(JsonMap.newBuilder()
                                        .putOpt("tag_groups", responseTags)
                                        .put("last_modified", "newDate")
                                        .build().toString())
                .create();

        TagGroupResponse newResponse = client.lookupTagGroups("some-channel", UAirship.ANDROID_PLATFORM, requestTags, response);

        // Should return the original response
        assertNotEquals(newResponse, response);
        assertEquals("newDate", newResponse.lastModifiedTime);
    }
/**
     * Test cached response is not returned if we get new data.
     */
Test cached response is not returned if we get new data.
Test cached response is not returned if we get new data .
@Test
    public void testCachedResponseNewData() {
        TagGroupResponse response = client.lookupTagGroups("some-channel", UAirship.ANDROID_PLATFORM, requestTags, null);
        testRequest.response = new Response.Builder(HttpURLConnection.HTTP_OK)
                .setResponseMessage("OK")
                .setResponseBody(JsonMap.newBuilder()
                                        .putOpt("tag_groups", responseTags)
                                        .put("last_modified", "newDate")
                                        .build().toString())
                .create();
        TagGroupResponse newResponse = client.lookupTagGroups("some-channel", UAirship.ANDROID_PLATFORM, requestTags, response);
        assertNotEquals(newResponse, response);
        assertEquals("newDate", newResponse.lastModifiedTime);
    }
@ Test public void testCachedResponseNewData ( ) { TagGroupResponse response = client . lookupTagGroups ( "some-channel" , UAirship . ANDROID_PLATFORM , requestTags , null ) ; testRequest . response = new Response . Builder ( HttpURLConnection . HTTP_OK ) . setResponseMessage ( "OK" ) . setResponseBody ( JsonMap . newBuilder ( ) . putOpt ( "tag_groups" , responseTags ) . put ( "last_modified" , "newDate" ) . build ( ) . toString ( ) ) . create ( ) ; TagGroupResponse newResponse = client . lookupTagGroups ( "some-channel" , UAirship . ANDROID_PLATFORM , requestTags , response ) ; assertNotEquals ( newResponse , response ) ; assertEquals ( "newDate" , newResponse . lastModifiedTime ) ; }
Test cached response is not returned if we get new data.
Test cached response is not returned if we get new data .
// Get a valid response // Update the response to return new data // Should return the original response