public static ServiceDefinition getSimpleService() { return ServiceDefinition.builder() .id("service-one-id") .name("Service One") .description("Description for Service One") .bindable(true) .plans(getPlanOne(), getPlanTwo(), getPlanThree()) .requires(ServiceDefinitionRequires.SERVICE_REQUIRES_SYSLOG_DRAIN.toString(), ServiceDefinitionRequires.SERVICE_REQUIRES_ROUTE_FORWARDING.toString()) .build(); }
assertThat(serviceDefinition.getTags()).contains("tag1", "tag2"); assertThat(serviceDefinition.getRequires()).contains( SERVICE_REQUIRES_ROUTE_FORWARDING.toString(), SERVICE_REQUIRES_SYSLOG_DRAIN.toString(), SERVICE_REQUIRES_VOLUME_MOUNT.toString(), "another_requires"); assertThat(serviceDefinition.getMetadata()).contains( assertThat(json).hasListAtPath("$.tags[*]").contains("tag1", "tag2"); assertThat(json).hasListAtPath("$.requires[*]").contains( SERVICE_REQUIRES_ROUTE_FORWARDING.toString(), SERVICE_REQUIRES_SYSLOG_DRAIN.toString(), SERVICE_REQUIRES_VOLUME_MOUNT.toString(), "another_requires"); assertThat(json).hasMapAtPath("$.metadata").contains(
.andExpect(jsonPath("$.services[*].bindable", contains(serviceDefinition.isBindable()))) .andExpect(jsonPath("$.services[*].requires[*]", containsInAnyOrder( SERVICE_REQUIRES_SYSLOG_DRAIN.toString(), SERVICE_REQUIRES_ROUTE_FORWARDING.toString()) )) .andExpect(jsonPath("$.services[*].plans[*]", hasSize(3)))
.jsonPath("$.services[0].requires").isNotEmpty() .jsonPath("$.services[0].requires").isArray() .jsonPath("$.services[0].requires[0]").isEqualTo(SERVICE_REQUIRES_SYSLOG_DRAIN.toString()) .jsonPath("$.services[0].requires[1]").isEqualTo(SERVICE_REQUIRES_ROUTE_FORWARDING.toString()) .jsonPath("$.services[0].requires[2]").doesNotExist() .jsonPath("$.services[0].plans").isNotEmpty()