diff --git a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/_Relationship.java b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/_Relationship.java index 0c48a0eda4..50ef5c951a 100644 --- a/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/_Relationship.java +++ b/cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/_Relationship.java @@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.cloudfoundry.Nullable; import org.immutables.value.Value; /** @@ -31,6 +32,7 @@ abstract class _Relationship { * The id */ @JsonProperty("guid") + @Nullable abstract String getId(); } diff --git a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/RelationshipTest.java b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/RelationshipTest.java index 61d59c23d6..2eac15a0a8 100644 --- a/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/RelationshipTest.java +++ b/cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/RelationshipTest.java @@ -16,23 +16,24 @@ package org.cloudfoundry.client.v3; -import static org.junit.jupiter.api.Assertions.assertThrows; - import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + final class RelationshipTest { @Test void noId() { - assertThrows( - IllegalStateException.class, - () -> { - Relationship.builder().build(); - }); + assertThat(Relationship.builder().build().getId()).isNull(); + } + + @Test + void nullId() { + assertThat(Relationship.builder().id(null).build().getId()).isNull(); } @Test - void valid() { - Relationship.builder().id("test-id").build(); + void nonNullId() { + assertThat(Relationship.builder().id("test-id").build().getId()).isEqualTo("test-id"); } }