Skip to content
Draft
Changes from all commits
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 @@ -540,26 +540,12 @@ public void testPerformsSumThatOverflowsMaxLong() {
"b", map("author", "authorB", "title", "titleB", "rating", Long.MAX_VALUE));
CollectionReference collection = testCollectionWithDocs(testDocs);

switch (getBackendEdition()) {
case STANDARD:
{
AggregateQuerySnapshot snapshot =
waitFor(collection.aggregate(sum("rating")).get(AggregateSource.SERVER));

Object sum = snapshot.get(sum("rating"));
assertTrue(sum instanceof Double);
assertEquals(sum, (double) Long.MAX_VALUE + (double) Long.MAX_VALUE);
break;
}
case ENTERPRISE:
{
assertThrows(
RuntimeException.class,
() -> {
waitFor(collection.aggregate(sum("rating")).get(AggregateSource.SERVER));
});
}
}
AggregateQuerySnapshot snapshot =
waitFor(collection.aggregate(sum("rating")).get(AggregateSource.SERVER));

Object sum = snapshot.get(sum("rating"));
assertTrue(sum instanceof Double);
assertEquals(sum, (double) Long.MAX_VALUE + (double) Long.MAX_VALUE);
}

@Test
Expand Down Expand Up @@ -589,20 +575,10 @@ public void testPerformsSumThatIsNegative() {
"d", map("author", "authorD", "title", "titleD", "rating", -10000));
CollectionReference collection = testCollectionWithDocs(testDocs);

switch (getBackendEdition()) {
case STANDARD:
AggregateQuerySnapshot snapshot =
waitFor(collection.aggregate(sum("rating")).get(AggregateSource.SERVER));

assertEquals(snapshot.get(sum("rating")), -10101L);
break;
case ENTERPRISE:
assertThrows(
RuntimeException.class,
() -> {
waitFor(collection.aggregate(sum("rating")).get(AggregateSource.SERVER));
});
}
AggregateQuerySnapshot snapshot =
waitFor(collection.aggregate(sum("rating")).get(AggregateSource.SERVER));

assertEquals(snapshot.get(sum("rating")), -10101L);
}

@Test
Expand Down Expand Up @@ -675,13 +651,7 @@ public void testPerformsSumOverResultSetOfZeroDocuments() {
.aggregate(sum("pages"))
.get(AggregateSource.SERVER));

switch (getBackendEdition()) {
case STANDARD:
assertEquals(snapshot.get(sum("pages")), 0L);
break;
case ENTERPRISE:
assertNull(snapshot.get(sum("pages")));
}
assertEquals(snapshot.get(sum("pages")), 0L);
}

@Test
Expand Down
Loading