This repository was archived by the owner on Dec 3, 2023. It is now read-only.
File tree
Expand file treeCollapse file tree2 files changed
+35
-2
lines changed main/java/com/google/cloud test/java/com/google/cloud
Expand file treeCollapse file tree2 files changed
+35
-2
lines changed Original file line number | Diff line number | Diff line change |
---|
|
18 | 18 |
|
19 | 19 | import com.google.api.core.BetaApi;
|
20 | 20 | import com.google.auto.value.AutoValue;
|
| 21 | +import org.checkerframework.checker.nullness.qual.Nullable; |
21 | 22 |
|
22 | 23 | /**
|
23 | 24 | * Class for Identity and Access Management (IAM) policies. IAM policies are used to specify access
|
|
32 | 33 | @AutoValue
|
33 | 34 | public abstract class Condition {
|
34 | 35 | /** Get IAM Policy Binding Condition Title */
|
| 36 | +@Nullable |
35 | 37 | public abstract String getTitle();
|
36 | 38 |
|
37 | 39 | /** Get IAM Policy Binding Condition Description */
|
| 40 | +@Nullable |
38 | 41 | public abstract String getDescription();
|
39 | 42 |
|
40 | 43 | /** Get IAM Policy Binding Condition Expression */
|
@@ -51,10 +54,10 @@ public static Builder newBuilder() {
|
51 | 54 | @AutoValue.Builder
|
52 | 55 | public abstract static class Builder {
|
53 | 56 | /** Set IAM Policy Binding Condition Title */
|
54 |
| -public abstract Builder setTitle(String title); |
| 57 | +public abstract Builder setTitle(@Nullable String title); |
55 | 58 |
|
56 | 59 | /** Set IAM Policy Binding Condition Description */
|
57 |
| -public abstract Builder setDescription(String description); |
| 60 | +public abstract Builder setDescription(@Nullable String description); |
58 | 61 |
|
59 | 62 | /** Set IAM Policy Binding Condition Expression */
|
60 | 63 | public abstract Builder setExpression(String expression);
|
|
Original file line number | Diff line number | Diff line change |
---|
|
| 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 | +} |
You can’t perform that action at this time.
0 commit comments