SpatineoMonitorDao { protected Response parse(final InputStream in) throws IOException { return om.readValue(in, Response.class); } SpatineoMonitorDao(String endPoint, String key);  SpatineoMonitorDao(String endPoint, String key,
            boolean allMeters, boolean lean);  SpatineoMonitorDao(String endPoint, String key,
            boolean allMeters, boolean lean, ObjectMapper om); Response query();  }
@Test public void testParseResponseOk() throws IOException { try (InputStream in = getClass().getResourceAsStream("/responseOk.json")) { Response response = monitor.parse(in); assertEquals("1.0", response.getVersion()); assertEquals("OK", response.getStatus()); assertNotNull(response.getResult()); assertEquals(81, response.getResult().size()); } }
@Test public void testParseResponseEmpty() throws IOException { try (InputStream in = getClass().getResourceAsStream("/responseEmpty.json")) { Response response = monitor.parse(in); assertEquals("1.0", response.getVersion()); assertEquals("OK", response.getStatus()); assertNull(response.getStatusMessage()); assertNotNull(response.getResult()); assertEquals(0, response.getResult().size()); } }
@Test public void testParseResponseError() throws IOException { try (InputStream in = getClass().getResourceAsStream("/responseError.json")) { Response response = monitor.parse(in); assertEquals("1.0", response.getVersion()); assertEquals("ERROR", response.getStatus()); assertEquals("No such API key", response.getStatusMessage()); assertNull(response.getResult()); } }