@Test public void responseWithValuesIsDeserialized() { GetServiceInstanceAppBindingResponse response = JsonUtils.readTestDataFile( "getAppBindingResponse.json", GetServiceInstanceAppBindingResponse.class); assertThat(response.getCredentials()).containsOnly(entry("cred1", "foo"), entry("cred2", "bar")); assertThat(response.getSyslogDrainUrl()).isEqualTo("https://logs.hello.local"); assertThat(response.getParameters()).containsOnly(entry("field1", "p1"), entry("field2", "p2")); assertThat(response.getVolumeMounts()).hasSize(1); VolumeMount volumeMount = response.getVolumeMounts().get(0); assertThat(volumeMount.getDriver()).isEqualTo("driver-1"); assertThat(volumeMount.getContainerDir()).isEqualTo("container-dir-1"); assertThat(volumeMount.getMode()).isEqualTo(VolumeMount.Mode.READ_ONLY); assertThat(volumeMount.getDeviceType()).isEqualTo(VolumeMount.DeviceType.SHARED); SharedVolumeDevice sharedVolumeDevice = ((SharedVolumeDevice)volumeMount.getDevice()); assertThat(sharedVolumeDevice.getVolumeId()).isEqualTo("volume-id"); assertThat(sharedVolumeDevice.getMountConfig()) .containsOnly(entry("field1", "mount-config-1"), entry("field2", "mount-config-2")); }
@Test public void responseWithDefaultsIsBuilt() { GetServiceInstanceAppBindingResponse response = GetServiceInstanceAppBindingResponse.builder() .build(); assertThat(response.getParameters()).hasSize(0); assertThat(response.getCredentials()).hasSize(0); assertThat(response.getSyslogDrainUrl()).isNull(); assertThat(response.getVolumeMounts()).hasSize(0); DocumentContext json = JsonUtils.toJsonPath(response); assertThat(json).hasNoPath("$.parameters"); assertThat(json).hasNoPath("$.credentials"); assertThat(json).hasNoPath("$.syslog_drain_url"); assertThat(json).hasNoPath("$.volume_mounts"); }
assertThat(response.getVolumeMounts()).hasSize(4);