Skip to content

Commit

Permalink
removed calls with default values
Browse files Browse the repository at this point in the history
  • Loading branch information
evanchooly committed Jun 21, 2024
1 parent 1bcfe44 commit 84dc0f7
Show file tree
Hide file tree
Showing 196 changed files with 665 additions and 1,235 deletions.
2 changes: 1 addition & 1 deletion audits/src/main/kotlin/dev/morphia/audits/RstAuditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class RstAuditor(val type: OperatorType) {
} else {
method.setBody(
"""
|testPipeline(new dev.morphia.test.util.ActionTestOptions().serverVersion(dev.morphia.test.ServerVersion.ANY).removeIds(false).orderMatters(true), aggregation -> aggregation
|testPipeline(aggregation -> aggregation
| .pipeline(
|
|)); """
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/java/dev/morphia/test/TemplatedTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private Method isTestMethod(StackTraceElement element) {
}

public void testQuery(Function<Query<Document>, Query<Document>> function) {
testQuery(new ActionTestOptions(), function);
testQuery(function);
}

public void testQuery(ActionTestOptions options,
Expand All @@ -228,7 +228,7 @@ public void testQuery(ActionTestOptions options,
}

public void testUpdate(Function<Query<Document>, Query<Document>> function, UpdateOperator... operators) {
testUpdate(new ActionTestOptions(), function, operators);
testUpdate(function, operators);
}

public void testUpdate(ActionTestOptions options,
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/java/dev/morphia/test/TestTransactions.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void merge() {
public void aggregation() {
getDs().withTransaction(session -> {
testPipeline(
new dev.morphia.test.util.ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(false),
new dev.morphia.test.util.ActionTestOptions().orderMatters(false),
aggregation -> {
loadData("aggTest2", 2);
return aggregation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ public class TestAbs extends TemplatedTestBase {
*/
@Test(testName = "main")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
aggregation -> aggregation
.pipeline(project().include("delta", abs(subtract("$startTemp", "$endTemp")))));
testPipeline(new ActionTestOptions().serverVersion(ANY), aggregation -> aggregation
.pipeline(project().include("delta", abs(subtract("$startTemp", "$endTemp")))));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public class TestAccumulator extends TemplatedTestBase {
*/
@Test(testName = "Use ``$accumulator`` to Implement the ``$avg`` Operator")
public void testExample1() {
testPipeline(
new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(false).skipActionCheck(true),
testPipeline(new ActionTestOptions().serverVersion(ANY).orderMatters(false).skipActionCheck(true),
aggregation -> aggregation.pipeline(Group.group(Group.id("$author")).field("avgCopies", accumulator("""
function() {
return { count: 0, sum: 0 }
Expand Down Expand Up @@ -48,8 +47,7 @@ public void testExample1() {
*/
@Test(testName = "Use ``initArgs`` to Vary the Initial State by Group")
public void testExample2() {
testPipeline(
new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(false).skipActionCheck(true),
testPipeline(new ActionTestOptions().serverVersion(ANY).orderMatters(false).skipActionCheck(true),
aggregation -> aggregation.pipeline(Group.group(Group.id().field("city", "$city")).field("restaurants",
accumulator("""
function(city, userProfileCity) { \s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ public class TestAcos extends TemplatedTestBase {
*/
@Test(testName = "main :: Inverse Cosine of Value in Degrees")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
aggregation -> aggregation.pipeline(
addFields().field("angle_a", radiansToDegrees(acos(divide("$side_b", "$hypotenuse"))))));
testPipeline(new ActionTestOptions().serverVersion(ANY), aggregation -> aggregation
.pipeline(addFields().field("angle_a", radiansToDegrees(acos(divide("$side_b", "$hypotenuse"))))));

}

Expand All @@ -30,9 +29,8 @@ public void testExample1() {
*/
@Test(testName = "main :: Inverse Cosine of Value in Radians")
public void testExample2() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
aggregation -> aggregation
.pipeline(addFields().field("angle_a", acos(divide("$side_b", "$hypotenuse")))));
testPipeline(new ActionTestOptions().serverVersion(ANY), aggregation -> aggregation
.pipeline(addFields().field("angle_a", acos(divide("$side_b", "$hypotenuse")))));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ public class TestAcosh extends TemplatedTestBase {
*/
@Test(testName = "main :: Inverse Hyperbolic Cosine in Degrees")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
aggregation -> aggregation
.pipeline(addFields().field("y-coordinate", radiansToDegrees(acosh("$x-coordinate")))));
testPipeline(new ActionTestOptions().serverVersion(ANY), aggregation -> aggregation
.pipeline(addFields().field("y-coordinate", radiansToDegrees(acosh("$x-coordinate")))));

}

Expand All @@ -29,7 +28,7 @@ public void testExample1() {
*/
@Test(testName = "main :: Inverse Hyperbolic Cosine in Radians")
public void testExample2() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
testPipeline(new ActionTestOptions().serverVersion(ANY),
aggregation -> aggregation.pipeline(addFields().field("y-coordinate", acosh("$x-coordinate"))));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ public class TestAdd extends TemplatedTestBase {
*/
@Test(testName = "Add Numbers")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation
.pipeline(project().include("item").include("total", add("$price", "$fee"))));
testPipeline(new ActionTestOptions().serverVersion(ANY), (aggregation) -> aggregation
.pipeline(project().include("item").include("total", add("$price", "$fee"))));
}

/**
Expand All @@ -27,9 +26,8 @@ public void testExample1() {
*/
@Test(testName = "Perform Addition on a Date")
public void testExample2() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
aggregation -> aggregation
.pipeline(project().include("item", 1).include("billing_date", add("$date", 259200000))));
testPipeline(new ActionTestOptions().serverVersion(ANY), aggregation -> aggregation
.pipeline(project().include("item", 1).include("billing_date", add("$date", 259200000))));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TestAddToSet extends TemplatedTestBase {
*/
@Test(testName = "Use in ``$group`` Stage")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(false),
testPipeline(new ActionTestOptions().serverVersion(ANY).orderMatters(false),
aggregation -> aggregation
.pipeline(group(Group.id().field("day", dayOfYear("$date")).field("year", year("$date")))
.field("itemsSold", addToSet("$item")))
Expand All @@ -39,7 +39,7 @@ public void testExample1() {
public void testExample2() {
if (1 == 1)
return;
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(false),
testPipeline(new ActionTestOptions().serverVersion(ANY).orderMatters(false),
aggregation -> aggregation.setWindowFields(setWindowFields().partitionBy("$state")
.sortBy(ascending("orderDate")).output(output("cakeTypesForState").operator(addToSet("$type"))
.window().documents("unbounded", "current"))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class TestAllElementsTrue extends TemplatedTestBase {
*/
@Test(testName = "main")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(false),
testPipeline(new ActionTestOptions().serverVersion(ANY).orderMatters(false),
aggregation -> aggregation.pipeline(Projection.project().suppressId().include("responses")
.include("isAllTrue", allElementsTrue("$responses"))));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ public class TestAnd extends TemplatedTestBase {
*/
@Test(testName = "main")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
aggregation -> aggregation.pipeline(project().include("item").include("qty").include("result",
and(gt("$qty", 100), lt("$qty", 250)))));
testPipeline(new ActionTestOptions().serverVersion(ANY), aggregation -> aggregation.pipeline(
project().include("item").include("qty").include("result", and(gt("$qty", 100), lt("$qty", 250)))));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ public class TestAnyElementTrue extends TemplatedTestBase {
*/
@Test(testName = "main")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ANY).removeIds(false).orderMatters(true),
aggregation -> aggregation.pipeline(project().suppressId().include("responses").include("isAnyTrue",
anyElementTrue("$responses"))));
testPipeline(new ActionTestOptions().serverVersion(ANY), aggregation -> aggregation.pipeline(
project().suppressId().include("responses").include("isAnyTrue", anyElementTrue("$responses"))));

}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.morphia.test.aggregation.expressions;

import dev.morphia.test.ServerVersion;
import dev.morphia.test.TemplatedTestBase;
import dev.morphia.test.util.ActionTestOptions;

import org.testng.annotations.Test;

Expand All @@ -16,8 +14,7 @@ public class TestArrayElemAt extends TemplatedTestBase {
*/
@Test(testName = "main")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation.pipeline(project().include("name")
.include("first", elementAt("$favorites", 0)).include("last", elementAt("$favorites", -1))));
testPipeline((aggregation) -> aggregation.pipeline(project().include("name")
.include("first", elementAt("$favorites", 0)).include("last", elementAt("$favorites", -1))));
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.morphia.test.aggregation.expressions;

import dev.morphia.test.ServerVersion;
import dev.morphia.test.TemplatedTestBase;
import dev.morphia.test.util.ActionTestOptions;

import org.testng.annotations.Test;

Expand All @@ -22,9 +20,8 @@ public class TestArrayToObject extends TemplatedTestBase {
*/
@Test(testName = "``$arrayToObject`` Example")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation
.pipeline(project().include("item").include("dimensions", arrayToObject("$dimensions"))));
testPipeline((aggregation) -> aggregation
.pipeline(project().include("item").include("dimensions", arrayToObject("$dimensions"))));
}

/**
Expand All @@ -33,12 +30,10 @@ public void testExample1() {
*/
@Test(testName = "``$objectToArray`` + ``$arrayToObject`` Example")
public void testExample2() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation.pipeline(addFields().field("instock", objectToArray("$instock")),
addFields().field("instock",
concatArrays("$instock",
array(document().field("k", "total").field("v", sum("$instock.v"))))),
addFields().field("instock", arrayToObject("$instock"))));
testPipeline((aggregation) -> aggregation.pipeline(addFields().field("instock", objectToArray("$instock")),
addFields().field("instock",
concatArrays("$instock", array(document().field("k", "total").field("v", sum("$instock.v"))))),
addFields().field("instock", arrayToObject("$instock"))));
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.morphia.test.aggregation.expressions;

import dev.morphia.test.ServerVersion;
import dev.morphia.test.TemplatedTestBase;
import dev.morphia.test.util.ActionTestOptions;

import org.testng.annotations.Test;

Expand All @@ -18,9 +16,8 @@ public class TestAsin extends TemplatedTestBase {
*/
@Test(testName = "main :: Inverse Sine of Value in Degrees")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation.pipeline(
addFields().field("angle_a", radiansToDegrees(asin(divide("$side_a", "$hypotenuse"))))));
testPipeline((aggregation) -> aggregation
.pipeline(addFields().field("angle_a", radiansToDegrees(asin(divide("$side_a", "$hypotenuse"))))));
}

/**
Expand All @@ -29,9 +26,8 @@ public void testExample1() {
*/
@Test(testName = "main :: Inverse Sine of Value in Radians")
public void testExample2() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation
.pipeline(addFields().field("angle_a", asin(divide("$side_a", "$hypotenuse")))));
testPipeline((aggregation) -> aggregation
.pipeline(addFields().field("angle_a", asin(divide("$side_a", "$hypotenuse")))));
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.morphia.test.aggregation.expressions;

import dev.morphia.test.ServerVersion;
import dev.morphia.test.TemplatedTestBase;
import dev.morphia.test.util.ActionTestOptions;

import org.testng.annotations.Test;

Expand All @@ -17,9 +15,8 @@ public class TestAsinh extends TemplatedTestBase {
*/
@Test(testName = "main :: Inverse Hyperbolic Sine in Degrees")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation
.pipeline(addFields().field("y-coordinate", radiansToDegrees(asinh("$x-coordinate")))));
testPipeline((aggregation) -> aggregation
.pipeline(addFields().field("y-coordinate", radiansToDegrees(asinh("$x-coordinate")))));
}

/**
Expand All @@ -28,8 +25,7 @@ public void testExample1() {
*/
@Test(testName = "main :: Inverse Hyperbolic Sine in Radians")
public void testExample2() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation.pipeline(addFields().field("y-coordinate", asinh("$x-coordinate"))));
testPipeline((aggregation) -> aggregation.pipeline(addFields().field("y-coordinate", asinh("$x-coordinate"))));
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.morphia.test.aggregation.expressions;

import dev.morphia.test.ServerVersion;
import dev.morphia.test.TemplatedTestBase;
import dev.morphia.test.util.ActionTestOptions;

import org.testng.annotations.Test;

Expand All @@ -18,9 +16,8 @@ public class TestAtan extends TemplatedTestBase {
*/
@Test(testName = "main :: Inverse Tangent of Value in Degrees")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation
.pipeline(addFields().field("angle_a", radiansToDegrees(atan(divide("$side_b", "$side_a"))))));
testPipeline((aggregation) -> aggregation
.pipeline(addFields().field("angle_a", radiansToDegrees(atan(divide("$side_b", "$side_a"))))));
}

/**
Expand All @@ -29,9 +26,8 @@ public void testExample1() {
*/
@Test(testName = "main :: Inverse Tangent of Value in Radians")
public void testExample2() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation
.pipeline(addFields().field("angle_a", atan(divide("$side_b", "$side_a")))));
testPipeline((aggregation) -> aggregation
.pipeline(addFields().field("angle_a", atan(divide("$side_b", "$side_a")))));
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.morphia.test.aggregation.expressions;

import dev.morphia.test.ServerVersion;
import dev.morphia.test.TemplatedTestBase;
import dev.morphia.test.util.ActionTestOptions;

import org.testng.annotations.Test;

Expand All @@ -17,9 +15,8 @@ public class TestAtan2 extends TemplatedTestBase {
*/
@Test(testName = "main :: Inverse Tangent of Value in Degrees")
public void testExample1() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation
.pipeline(addFields().field("angle_a", radiansToDegrees(atan2("$side_b", "$side_a")))));
testPipeline((aggregation) -> aggregation
.pipeline(addFields().field("angle_a", radiansToDegrees(atan2("$side_b", "$side_a")))));
}

/**
Expand All @@ -28,8 +25,7 @@ public void testExample1() {
*/
@Test(testName = "main :: Inverse Tangent of Value in Radians")
public void testExample2() {
testPipeline(new ActionTestOptions().serverVersion(ServerVersion.ANY).removeIds(false).orderMatters(true),
(aggregation) -> aggregation.pipeline(addFields().field("angle_a", atan2("$side_b", "$side_a"))));
testPipeline((aggregation) -> aggregation.pipeline(addFields().field("angle_a", atan2("$side_b", "$side_a"))));
}

}
Loading

0 comments on commit 84dc0f7

Please sign in to comment.