This repository was archived by the owner on Dec 3, 2023. It is now read-only.

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.google.api.core.BetaApi;
2020
import com.google.auto.value.AutoValue;
21+
import org.checkerframework.checker.nullness.qual.Nullable;
2122

2223
/**
2324
* Class for Identity and Access Management (IAM) policies. IAM policies are used to specify access
@@ -32,9 +33,11 @@
3233
@AutoValue
3334
public abstract class Condition {
3435
/** Get IAM Policy Binding Condition Title */
36+
@Nullable
3537
public abstract String getTitle();
3638

3739
/** Get IAM Policy Binding Condition Description */
40+
@Nullable
3841
public abstract String getDescription();
3942

4043
/** Get IAM Policy Binding Condition Expression */
@@ -51,10 +54,10 @@ public static Builder newBuilder() {
5154
@AutoValue.Builder
5255
public abstract static class Builder {
5356
/** Set IAM Policy Binding Condition Title */
54-
public abstract Builder setTitle(String title);
57+
public abstract Builder setTitle(@Nullable String title);
5558

5659
/** Set IAM Policy Binding Condition Description */
57-
public abstract Builder setDescription(String description);
60+
public abstract Builder setDescription(@Nullable String description);
5861

5962
/** Set IAM Policy Binding Condition Expression */
6063
public abstract Builder setExpression(String expression);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.google.cloud;
2+
3+
import static com.google.common.truth.Truth.assertThat;
4+
5+
import org.junit.Test;
6+
7+
public final class ConditionTest {
8+
9+
@Test
10+
public void title_nullable() {
11+
Condition condition = Condition.newBuilder()
12+
.setTitle(null)
13+
.setDescription("desc")
14+
.setExpression("expr")
15+
.build();
16+
17+
assertThat(condition.getTitle()).isNull();
18+
}
19+
20+
@Test
21+
public void description_nullable() {
22+
Condition condition = Condition.newBuilder()
23+
.setTitle("title")
24+
.setDescription(null)
25+
.setExpression("expr")
26+
.build();
27+
28+
assertThat(condition.getDescription()).isNull();
29+
}
30+
}

0 commit comments

Comments
 (0)