public void testApplyInputStreamDetails() throws UnknownHostException { InputStream is = getClass().getResourceAsStream("/test_list_backupschedule.json"); UnwrapOnlyJsonValue<BackupSchedule> parser = i.getInstance(Key.get(new TypeLiteral<UnwrapOnlyJsonValue<BackupSchedule>>() {})); BackupSchedule response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); assertEquals( new BackupSchedule(WeeklyBackup.THURSDAY, DailyBackup.H_0400_0600, true), response); }
public void testNoSchedule() throws UnknownHostException { UnwrapOnlyJsonValue<BackupSchedule> parser = i.getInstance(Key.get(new TypeLiteral<UnwrapOnlyJsonValue<BackupSchedule>>() {})); BackupSchedule response = parser.apply( new HttpResponse( 200, "ok", Payloads.newStringPayload("{\"backupSchedule\":{\"enabled\" : false}}"))); assertEquals(new BackupSchedule(), response); }
public void testApplyInputStreamDetails() throws UnknownHostException { InputStream is = getClass().getResourceAsStream("/test_list_addresses.json"); UnwrapOnlyJsonValue<Addresses> parser = i.getInstance(Key.get(new TypeLiteral<UnwrapOnlyJsonValue<Addresses>>() {})); Addresses response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); List<String> publicAddresses = ImmutableList.of("67.23.10.132", "67.23.10.131"); List<String> privateAddresses = ImmutableList.of("10.176.42.16"); assertEquals(response.getPublicAddresses(), publicAddresses); assertEquals(response.getPrivateAddresses(), privateAddresses); }