@Test public void responseWithAllValuesIsDeserialized() { GetLastServiceBindingOperationResponse response = JsonUtils.readTestDataFile( "getLastOperationResponse.json", GetLastServiceBindingOperationResponse.class); assertThat(response.getState()).isEqualTo(OperationState.SUCCEEDED); assertThat(response.getDescription()).isEqualTo("description"); }
@Test public void responseWithAllValuesIsBuilt() { GetLastServiceBindingOperationResponse response = GetLastServiceBindingOperationResponse.builder() .operationState(OperationState.SUCCEEDED) .description("description") .deleteOperation(true) .build(); assertThat(response.getState()).isEqualTo(OperationState.SUCCEEDED); assertThat(response.getDescription()).isEqualTo("description"); assertThat(response.isDeleteOperation()).isEqualTo(true); DocumentContext json = JsonUtils.toJsonPath(response); assertThat(json).hasPath("$.state").isEqualTo(OperationState.SUCCEEDED.toString()); assertThat(json).hasPath("$.description").isEqualTo("description"); }
@Test public void responseWithDefaultsIsBuilt() { GetLastServiceBindingOperationResponse response = GetLastServiceBindingOperationResponse.builder() .build(); assertThat(response.getState()).isNull(); assertThat(response.getDescription()).isNull(); assertThat(response.isDeleteOperation()).isEqualTo(false); DocumentContext json = JsonUtils.toJsonPath(response); assertThat(json).hasNoPath("$.state"); assertThat(json).hasNoPath("$.description"); }