Skip to content

Commit bfc6559

Browse files
committed
Makes guid optional in Relationship
Signed-off-by: kvmw <[email protected]>
1 parent 97574d5 commit bfc6559

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/_Relationship.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.fasterxml.jackson.annotation.JsonProperty;
2020
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
21+
import org.cloudfoundry.Nullable;
2122
import org.immutables.value.Value;
2223

2324
/**
@@ -31,6 +32,7 @@ abstract class _Relationship {
3132
* The id
3233
*/
3334
@JsonProperty("guid")
35+
@Nullable
3436
abstract String getId();
3537

3638
}

cloudfoundry-client/src/test/java/org/cloudfoundry/client/v3/RelationshipTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@
1616

1717
package org.cloudfoundry.client.v3;
1818

19-
import static org.junit.jupiter.api.Assertions.assertThrows;
20-
2119
import org.junit.jupiter.api.Test;
2220

21+
import static org.assertj.core.api.Assertions.assertThat;
22+
2323
final class RelationshipTest {
2424

2525
@Test
2626
void noId() {
27-
assertThrows(
28-
IllegalStateException.class,
29-
() -> {
30-
Relationship.builder().build();
31-
});
27+
assertThat(Relationship.builder().build().getId()).isNull();
28+
}
29+
30+
@Test
31+
void nullId() {
32+
assertThat(Relationship.builder().id(null).build().getId()).isNull();
3233
}
3334

3435
@Test
35-
void valid() {
36-
Relationship.builder().id("test-id").build();
36+
void nonNullId() {
37+
assertThat(Relationship.builder().id("test-id").build().getId()).isEqualTo("test-id");
3738
}
3839
}

0 commit comments

Comments
 (0)