Catalog { public List<ServiceDefinition> getServiceDefinitions() { return this.serviceDefinitions; } Catalog();  Catalog(List<ServiceDefinition> serviceDefinitions); List<ServiceDefinition> getServiceDefinitions(); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); static CatalogBuilder builder();  }
@Test void catalogWithServicesIsDeserializedFromJson() { Catalog catalog = JsonUtils.readTestDataFile("catalog.json", Catalog.class); assertThat(catalog.getServiceDefinitions().get(0).getId()).isEqualTo("service-one-id"); assertThat(catalog.getServiceDefinitions().get(0).getPlans().get(1).getMetadata()) .contains( entry("displayName", "sample display name"), entry("bullets", Arrays.asList("bullet1", "bullet2")), entry("key1", "value1"), entry("key2", "value2")); @SuppressWarnings("unchecked") Map<String, Object> cost = ((List<Map<String, Object>>) catalog.getServiceDefinitions().get(0).getPlans().get(1).getMetadata().get( "costs")).get(0); assertThat(cost.get("unit")).isEqualTo("MONTHLY"); @SuppressWarnings("unchecked") Map<String, Object> amount = (Map<String, Object>) cost.get("amount"); assertThat(amount).containsOnly(entry("usd", 649.0)); }