Skip to content

Commit

Permalink
Merge pull request #1233 from kvmw/kvmw/fix-1231
Browse files Browse the repository at this point in the history
Makes guid optional in Relationship
  • Loading branch information
anthonydahanne authored Jul 10, 2024
2 parents 97574d5 + bc8996f commit 1fffc4c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -31,6 +32,7 @@ abstract class _Relationship {
* The id
*/
@JsonProperty("guid")
@Nullable
abstract String getId();

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,24 @@

package org.cloudfoundry.client.v3;

import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

final class RelationshipTest {

@Test
void noId() {
assertThrows(
IllegalStateException.class,
() -> {
Relationship.builder().build();
});
assertThat(Relationship.builder().build().getId()).isNull();
}

@Test
void valid() {
Relationship.builder().id("test-id").build();
void nullId() {
assertThat(Relationship.builder().id(null).build().getId()).isNull();
}

@Test
void nonNullId() {
assertThat(Relationship.builder().id("test-id").build().getId()).isEqualTo("test-id");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ final class ShareDomainRequestTest {

@Test
void emptyRelationship() {
assertThrows(
IllegalStateException.class,
() -> {
ShareDomainRequest.builder()
.domainId("test-domain-id")
.data(Relationship.builder().build())
.build();
});
ShareDomainRequest.builder()
.domainId("test-domain-id")
.data(Relationship.builder().build())
.build();
}

@Test
Expand Down

0 comments on commit 1fffc4c

Please sign in to comment.