You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "garydgregory (via GitHub)" <gi...@apache.org> on 2023/02/06 22:38:07 UTC

[GitHub] [commons-lang] garydgregory commented on a diff in pull request #983: Simplify streams.

garydgregory commented on code in PR #983:
URL: https://github.com/apache/commons-lang/pull/983#discussion_r1097991816


##########
src/test/java/org/apache/commons/lang3/stream/StreamsTest.java:
##########
@@ -136,25 +136,25 @@ public Stream<DynamicTest> simpleStreamForEachFailing() {
 
     @Test
     public void testInstanceOfStream() {
-        assertEquals(2, Streams.instancesOf(String.class, Arrays.asList("A", "B")).collect(Collectors.toList()).size());
-        assertEquals(2, Streams.instancesOf(String.class, Arrays.asList(null, "A", null, "B", null)).collect(Collectors.toList()).size());
-        assertEquals(0, Streams.instancesOf(String.class, Arrays.asList(null, null)).collect(Collectors.toList()).size());
+        assertEquals(2, (int) Streams.instancesOf(String.class, Arrays.asList("A", "B")).count());

Review Comment:
   Why clutter up the code with all these type-casts? Just let the compiler pick up the `long` version of the JUnit API IMO.



-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org