Abacn commented on code in PR #23014:
URL: https://github.com/apache/beam/pull/23014#discussion_r984099510
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/logicaltypes/LogicalTypesTest.java:
##########
@@ -130,4 +133,51 @@ public void testSchema() {
schemaValue,
new SchemaLogicalType().toInputType(new
SchemaLogicalType().toBaseType(schemaValue)));
}
+
+ @Test
+ public void testFixedPrecisionNumeric() {
+ final int precision = 10;
+ final int scale = 2;
+ Random random = new Random();
+
+ Schema argumentSchema =
+
Schema.builder().addInt32Field("precision").addInt32Field("scale").build();
+
+ // invalid schema
+ final Schema invalidArgumentSchema =
+
Schema.builder().addInt32Field("invalid").addInt32Field("schema").build();
+ assertThrows(
+ IllegalArgumentException.class,
+ () ->
+ FixedPrecisionNumeric.of(
+ Row.withSchema(invalidArgumentSchema).addValues(precision,
scale).build()));
Review Comment:
Yes I agree in general this is best practice, I observed the file
`LogicalTypesTest.java` has each test testing one logical type and keep the new
test following this. If tests become more loaded we can split test source files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]