Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit 3e1beee

Browse files
chore: generate libraries at Wed Jan 21 18:00:03 UTC 2026
1 parent 8150e6a commit 3e1beee

2 files changed

Lines changed: 30 additions & 23 deletions

File tree

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GcRuleBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
/**
2424
* Factory for creating safe GcRule protos.
2525
*
26-
* <p>Use this class to construct {@link GcRule} instances instead of the raw proto builder
27-
* ({@link GcRule#newBuilder()}) to avoid common pitfalls with "oneof" fields (e.g. accidentally
28-
* overwriting max age with max versions).
26+
* <p>Use this class to construct {@link GcRule} instances instead of the raw proto builder ({@link
27+
* GcRule#newBuilder()}) to avoid common pitfalls with "oneof" fields (e.g. accidentally overwriting
28+
* max age with max versions).
2929
*/
3030
public final class GcRuleBuilder {
3131
private GcRuleBuilder() {} // Static utility

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/GcRuleBuilderTest.java

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
import com.google.bigtable.admin.v2.GcRule;
2222
import com.google.protobuf.util.Durations;
23+
import java.time.Duration;
2324
import org.junit.Test;
2425
import org.junit.runner.RunWith;
2526
import org.junit.runners.JUnit4;
26-
import java.time.Duration;
2727

2828
@RunWith(JUnit4.class)
2929
public class GcRuleBuilderTest {
@@ -89,28 +89,35 @@ public void union_buildsNestedRules() {
8989
@Test
9090
public void nestedComplexRules_workCorrectly() {
9191
// Expected Proto structure: Union of (Version(1) OR Intersection(Age(1h) AND Version(5)))
92-
GcRule expected = GcRule.newBuilder()
93-
.setUnion(GcRule.Union.newBuilder()
94-
.addRules(GcRule.newBuilder().setMaxNumVersions(1).build())
95-
.addRules(GcRule.newBuilder()
96-
.setIntersection(GcRule.Intersection.newBuilder()
97-
.addRules(GcRule.newBuilder()
98-
.setMaxAge(Durations.fromHours(1))
99-
.build())
100-
.addRules(GcRule.newBuilder().setMaxNumVersions(5).build())
92+
GcRule expected =
93+
GcRule.newBuilder()
94+
.setUnion(
95+
GcRule.Union.newBuilder()
96+
.addRules(GcRule.newBuilder().setMaxNumVersions(1).build())
97+
.addRules(
98+
GcRule.newBuilder()
99+
.setIntersection(
100+
GcRule.Intersection.newBuilder()
101+
.addRules(
102+
GcRule.newBuilder()
103+
.setMaxAge(Durations.fromHours(1))
104+
.build())
105+
.addRules(GcRule.newBuilder().setMaxNumVersions(5).build())
106+
.build())
107+
.build())
101108
.build())
102-
.build())
103-
.build())
104-
.build();
109+
.build();
105110

106111
// Using the new Builder
107-
GcRule actual = GcRuleBuilder.union()
108-
.add(GcRuleBuilder.maxVersions(1))
109-
.add(GcRuleBuilder.intersection()
110-
.add(GcRuleBuilder.maxAge(Duration.ofHours(1)))
111-
.add(GcRuleBuilder.maxVersions(5))
112-
.build())
113-
.build();
112+
GcRule actual =
113+
GcRuleBuilder.union()
114+
.add(GcRuleBuilder.maxVersions(1))
115+
.add(
116+
GcRuleBuilder.intersection()
117+
.add(GcRuleBuilder.maxAge(Duration.ofHours(1)))
118+
.add(GcRuleBuilder.maxVersions(5))
119+
.build())
120+
.build();
114121

115122
// Verify the structure matches the raw proto construction
116123
assertThat(actual).isEqualTo(expected);

0 commit comments

Comments
 (0)