Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -298,8 +298,6 @@ public static void applyCustomizations(final TestDef def) {
.file("unified-test-format/tests/valid-pass", "kmsProviders-mixed_kms_credential_fields");
def.skipJira("https://jira.mongodb.org/browse/JAVA-5672")
.file("unified-test-format/tests/valid-pass", "operator-matchAsRoot");
def.skipJira("https://jira.mongodb.org/browse/JAVA-5682")
.file("unified-test-format/tests/valid-pass", "operator-type-number_alias");

// valid fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.stream.Collectors;

import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -158,7 +159,12 @@ private void assertValuesMatch(final BsonValue initialExpected, @Nullable final
private void assertExpectedType(final BsonValue actualValue, final BsonValue expectedTypes) {
List<String> types;
if (expectedTypes.isString()) {
types = singletonList(expectedTypes.asString().getValue());
String expectedType = expectedTypes.asString().getValue();
if (expectedType.equals("number")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion only. Nothing needs to be done.

I know in this specific case, expectedfType can't be null, but generally speaking, it is a good practice to put string constant to the left hand side of equals() method to avoid NPE.

if ("number".equals(expectedType)) {

Not a big deal for sure.

types = asList("int", "long", "double", "decimal");
} else {
types = singletonList(expectedType);
}
} else if (expectedTypes.isArray()) {
types = expectedTypes.asArray().stream().map(type -> type.asString().getValue()).collect(Collectors.toList());
} else {
Expand Down