@Test public void getMessage() throws IOException { try { LocalIRKit.getMessage(null, new HttpClient()); fail("IllegalArgumentException is not thrown"); } catch (IllegalArgumentException e) { } try { LocalIRKit.getMessage(mInetAddress, null); fail("IllegalArgumentException is not thrown"); } catch (IllegalArgumentException e) { } { 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) { } } }
public static Message getMessage(InetAddress inetAddress) throws IOException { return getMessage(inetAddress, new HttpClient()); }
LocalIRKit { public static Message getMessage(InetAddress inetAddress) throws IOException { return getMessage(inetAddress, new HttpClient()); } }
LocalIRKit { public static Message getMessage(InetAddress inetAddress) throws IOException { return getMessage(inetAddress, new HttpClient()); } private  LocalIRKit(); }
LocalIRKit { public static Message getMessage(InetAddress inetAddress) throws IOException { return getMessage(inetAddress, new HttpClient()); } private  LocalIRKit(); static String getKeys(InetAddress inetAddress); static Message getMessage(InetAddress inetAddress); static void postMessage(InetAddress inetAddress, String format, int frequency, int[] data); static void postMessage(InetAddress inetAddress, String format, int frequency, int[] data, HttpClient httpClient); static void postMessage(InetAddress inetAddress, Message message); static void postWifi(InetAddress inetAddress, Serializer.WifiSecurity wifiSecurity, String ssid, String password, String deviceKey); }
LocalIRKit { public static Message getMessage(InetAddress inetAddress) throws IOException { return getMessage(inetAddress, new HttpClient()); } private  LocalIRKit(); static String getKeys(InetAddress inetAddress); static Message getMessage(InetAddress inetAddress); static void postMessage(InetAddress inetAddress, String format, int frequency, int[] data); static void postMessage(InetAddress inetAddress, String format, int frequency, int[] data, HttpClient httpClient); static void postMessage(InetAddress inetAddress, Message message); static void postWifi(InetAddress inetAddress, Serializer.WifiSecurity wifiSecurity, String ssid, String password, String deviceKey);  }