Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes guid optional in Relationship #1233

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
anthonydahanne marked this conversation as resolved.
Show resolved Hide resolved

import static org.junit.jupiter.api.Assertions.assertThrows;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

anthonydahanne marked this conversation as resolved.
Show resolved Hide resolved
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");
}
}
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
Loading