@Test public void responseWithAllValuesIsDeserialized() { CreateServiceInstanceResponse response = JsonUtils.readTestDataFile( "createResponse.json", CreateServiceInstanceResponse.class); assertThat(response.getOperation()).isEqualTo("in progress"); assertThat(response.getDashboardUrl()).isEqualTo("https://dashboard.local"); }
@Test public void responseWithAllValuesIsBuilt() { CreateServiceInstanceResponse response = CreateServiceInstanceResponse.builder() .async(true) .operation("in progress") .instanceExisted(true) .dashboardUrl("http://dashboard.example.com") .build(); assertThat(response.isAsync()).isEqualTo(true); assertThat(response.getOperation()).isEqualTo("in progress"); assertThat(response.isInstanceExisted()).isEqualTo(true); assertThat(response.getDashboardUrl()).isEqualTo("http://dashboard.example.com"); DocumentContext json = JsonUtils.toJsonPath(response); assertThat(json).hasPath("$.operation").isEqualTo("in progress"); assertThat(json).hasPath("$.dashboard_url").isEqualTo("http://dashboard.example.com"); }
@Test public void responseWithDefaultsIsBuilt() { CreateServiceInstanceResponse response = CreateServiceInstanceResponse.builder() .build(); assertThat(response.isAsync()).isEqualTo(false); assertThat(response.getOperation()).isNull(); assertThat(response.isInstanceExisted()).isEqualTo(false); assertThat(response.getDashboardUrl()).isNull(); DocumentContext json = JsonUtils.toJsonPath(response); assertThat(json).hasNoPath("$.operation"); assertThat(json).hasNoPath("$.dashboard_url"); }