yunfengzhou-hub commented on a change in pull request #37:
URL: https://github.com/apache/flink-ml/pull/37#discussion_r767493995
##########
File path: flink-ml-core/src/test/java/org/apache/flink/ml/api/StageTest.java
##########
@@ -388,5 +388,13 @@ public void testValidators() {
ParamValidator<Integer> notNull = ParamValidators.notNull();
Assert.assertTrue(notNull.validate(5));
Assert.assertFalse(notNull.validate(null));
+
+ ParamValidator<Object[]> nonEmptyArray =
ParamValidators.nonEmptyArray();
+ Assert.assertTrue(nonEmptyArray.validate(new String[] {"1"}));
+ Assert.assertFalse(nonEmptyArray.validate(null));
+ Assert.assertFalse(nonEmptyArray.validate(new String[0]));
+
+ ParamValidator<Integer> nonEmptyArrayInteger =
ParamValidators.nonEmptyArray();
Review comment:
I wanted to test that the ParamValidator should fail of its generic is
not an array type. I found that it can be achieved by
```java
public static <T> ParamValidator<T[]> nonEmptyArray()
```
and get the error at compile time. In this way I don't need the
`ParamValidator<Integer>` check anymore. I'll remove it.
--
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]