ChannelApiClient { @NonNull Response<Void> updateChannelWithPayload(@NonNull String channelId, @NonNull ChannelRegistrationPayload channelPayload) throws RequestException { Logger.verbose("ChannelApiClient - Updating channel with payload: %s", channelPayload); return requestFactory.createRequest() .setOperation("PUT", getDeviceUrl(channelId)) .setCredentials(runtimeConfig.getConfigOptions().appKey, runtimeConfig.getConfigOptions().appSecret) .setRequestBody(channelPayload) .setAirshipJsonAcceptsHeader() .execute(); } ChannelApiClient(@NonNull AirshipRuntimeConfig runtimeConfig); @VisibleForTesting  ChannelApiClient(@NonNull AirshipRuntimeConfig runtimeConfig,
                     @NonNull RequestFactory requestFactory);   }
@Test public void testUpdateChannelSucceedsRequest() throws Exception { testRequest.responseStatus = 200; Response<Void> response = client.updateChannelWithPayload("someChannelId", payload); assertEquals("PUT", testRequest.getRequestMethod()); assertEquals("https: assertEquals(testRequest.getRequestBody(), payload.toJsonValue().toString()); assertEquals(200, response.getStatus()); }
@Test public void testUpdateChannelFailsRequest() throws Exception { testRequest.responseStatus = 501; String channelId = "someChannelId"; Response<Void> response = client.updateChannelWithPayload(channelId, payload); assertEquals("PUT", testRequest.getRequestMethod()); assertEquals("https: assertEquals(testRequest.getRequestBody(), payload.toJsonValue().toString()); assertEquals(501, response.getStatus()); }