| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; | |
| 20 | 20 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |
| 21 | + import org.cloudfoundry.Nullable; | ||
| 21 | 22 | import org.immutables.value.Value; | |
| 22 | 23 | ||
| 23 | 24 | /** | |
@@ -31,6 +32,7 @@ abstract class _Relationship { | |||
| 31 | 32 | * The id | |
| 32 | 33 | */ | |
| 33 | 34 | @JsonProperty("guid") | |
| 35 | + @Nullable | ||
| 34 | 36 | abstract String getId(); | |
| 35 | 37 | ||
| 36 | 38 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,23 +16,24 @@ | |||
| 16 | 16 | ||
| 17 | 17 | package org.cloudfoundry.client.v3; | |
| 18 | 18 | ||
| 19 | - import static org.junit.jupiter.api.Assertions.assertThrows; | ||
| 19 | + import static org.assertj.core.api.Assertions.assertThat; | ||
| 20 | 20 | ||
| 21 | 21 | import org.junit.jupiter.api.Test; | |
| 22 | 22 | ||
| 23 | 23 | final class RelationshipTest { | |
| 24 | 24 | ||
| 25 | 25 | @Test | |
| 26 | 26 | void noId() { | |
| 27 | - assertThrows( | ||
| 28 | - IllegalStateException.class, | ||
| 29 | - () -> { | ||
| 30 | - Relationship.builder().build(); | ||
| 31 | - }); | ||
| 27 | + assertThat(Relationship.builder().build().getId()).isNull(); | ||
| 32 | 28 | } | |
| 33 | 29 | ||
| 34 | 30 | @Test | |
| 35 | - void valid() { | ||
| 36 | - Relationship.builder().id("test-id").build(); | ||
| 31 | + void nullId() { | ||
| 32 | + assertThat(Relationship.builder().id(null).build().getId()).isNull(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Test | ||
| 36 | + void nonNullId() { | ||
| 37 | + assertThat(Relationship.builder().id("test-id").build().getId()).isEqualTo("test-id"); | ||
| 37 | 38 | } | |
| 38 | 39 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,14 +25,10 @@ final class ShareDomainRequestTest { | |||
| 25 | 25 | ||
| 26 | 26 | @Test | |
| 27 | 27 | void emptyRelationship() { | |
| 28 | - assertThrows( | ||
| 29 | - IllegalStateException.class, | ||
| 30 | - () -> { | ||
| 31 | - ShareDomainRequest.builder() | ||
| 32 | - .domainId("test-domain-id") | ||
| 33 | - .data(Relationship.builder().build()) | ||
| 34 | - .build(); | ||
| 35 | - }); | ||
| 28 | + ShareDomainRequest.builder() | ||
| 29 | + .domainId("test-domain-id") | ||
| 30 | + .data(Relationship.builder().build()) | ||
| 31 | + .build(); | ||
| 36 | 32 | } | |
| 37 | 33 | ||
| 38 | 34 | @Test | |
| Back | FazBrowse Home | New Git URL |
0 commit comments