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

Commit 5cc6646

Browse files
committed
Update ITPipelineTest.java
1 parent 9dea743 commit 5cc6646

1 file changed

Lines changed: 5 additions & 20 deletions

File tree

google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITPipelineTest.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -874,30 +874,15 @@ public void whereByNorCondition() throws Exception {
874874

875875
@Test
876876
public void selectWithSwitchOn() throws Exception {
877-
// supports basic switch
878877
List<PipelineResult> results =
879-
firestore
880-
.pipeline()
881-
.createFrom(collection)
882-
.limit(1)
883-
.replaceWith(Expression.map(map("value", 1)))
884-
.select(
885-
switchOn(equal(field("value"), 1), constant("one"), constant("NA")).as("result1"),
886-
switchOn(equal(field("value"), 2), constant("two"), constant("NA")).as("result2"))
887-
.execute()
888-
.get()
889-
.getResults();
890-
891-
assertThat(data(results)).isEqualTo(Lists.newArrayList(map("result1", "one", "result2", "NA")));
892-
893-
// supports multi-branch switch
894-
results =
895878
firestore
896879
.pipeline()
897880
.createFrom(collection)
898881
.limit(1)
899882
.replaceWith(Expression.map(map("value", 2)))
900883
.select(
884+
switchOn(equal(field("value"), 2), constant("two"), constant("NA")).as("result1"),
885+
switchOn(equal(field("value"), 3), constant("three"), constant("NA")).as("result2"),
901886
switchOn(
902887
equal(field("value"), 1),
903888
constant("one"),
@@ -906,12 +891,12 @@ public void selectWithSwitchOn() throws Exception {
906891
equal(field("value"), 3),
907892
constant("three"),
908893
constant("default"))
909-
.as("result"))
894+
.as("result3"))
910895
.execute()
911896
.get()
912897
.getResults();
913-
914-
assertThat(data(results)).isEqualTo(Lists.newArrayList(map("result", "two")));
898+
assertThat(data(results))
899+
.isEqualTo(Lists.newArrayList(map("result1", "two", "result2", "NA", "result3", "two")));
915900

916901
// throws if no match and no default
917902
ExecutionException exception =

0 commit comments

Comments
 (0)