@Test
public void getMessage() throws IOException {

    try {
        LocalIRKit.getMessage(null, new HttpClient());
        fail("IllegalArgumentException is not thrown");
    } catch (IllegalArgumentException e) {
        // OK
    }
    try {
        LocalIRKit.getMessage(mInetAddress, null);
        fail("IllegalArgumentException is not thrown");
    } catch (IllegalArgumentException e) {
        // OK
    }
    {
        HttpClient httpClient = mock(HttpClient.class);
        HttpResponse httpResponse = mock(HttpResponse.class);
        when(httpResponse.getStatusCode()).thenReturn(200);
        when(httpResponse.getContent()).thenReturn("{\"format\":\"raw\",\"freq\":38,\"data\":[18031,8755,1190,1190,1190,3341,1190,3341,1190,3341,1190,1190,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,1190,1190,1190,1190,1190,1190,1190,1190,3341,1190,3341,1190,1190,1190,3341,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,65535,0,9379,18031,4400,1190]}");
        when(httpClient.request(Mockito.notNull(HttpRequest.class))).thenReturn(httpResponse);
        Message message = LocalIRKit.getMessage(mInetAddress, httpClient);
        assertThat(message.getFormat(), is("raw"));
        assertThat(message.getFrequency(), is(38));
        assertThat(message.getData(), is(new int[]{18031, 8755, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 65535, 0, 9379, 18031, 4400, 1190}));
    }
    {
        HttpClient httpClient = mock(HttpClient.class);
        HttpResponse httpResponse = mock(HttpResponse.class);
        when(httpResponse.getStatusCode()).thenReturn(500);
        when(httpClient.request(Mockito.notNull(HttpRequest.class))).thenReturn(httpResponse);
        try {
            LocalIRKit.getMessage(mInetAddress, httpClient);
            fail("UnexpectedStatusCodeException is not thrown");
        } catch (UnexpectedStatusCodeException e) {
            // OK
        }
    }
}