-
Notifications
You must be signed in to change notification settings - Fork 624
Drop remaining primitive FieldValue types #1207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop remaining primitive FieldValue types #1207
Conversation
ccb18f6
to
522db2f
Compare
Codecov Report
Continue to review full report at Codecov.
|
/test check-changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -41,34 +41,47 @@ | |||
public static final Value NULL_VALUE = | |||
Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build(); | |||
|
|||
/** The order of types in Firestore; this order is defined by the backend. */ | |||
private static final int TYPE_ORDER_NULL = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public methods that return private values make little sense. typeOrder
should either be private or these constants should be public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made them public.
@@ -291,4 +287,8 @@ public void testRejectsJavaArrays() { | |||
private Object convertValue(FieldValue value) { | |||
return writer.convertValue(value.getProto()); | |||
} | |||
|
|||
private void assertValueType(FieldValue value, Value.ValueTypeCase booleanValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JUnit tends to put the expected value as the first argument. Consider reversing these to match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this. Note that I have a similar helper for canonical IDs, which I kept the same as the callsites look much cleaner in reverse argument order.
"b", fromMap("c", StringValue.valueOf("foo")), "d", BooleanValue.valueOf(true))); | ||
assertEquals(expected, actual); | ||
ObjectValue.Builder expected = ObjectValue.newBuilder(); | ||
expected.set(field("a.b.c"), valueOf("foo")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: You could chain these (ObjectValue expected = newBuilder.set.set.build()
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It felt cleaner to spread these assignments over multiple lines. Kept as is.
191d029
to
2ce8a22
Compare
No description provided.