File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
JavaReleases/src/test/java/pl/mperor/lab/java Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,25 @@ private static boolean nonEmptyString(Object obj) {
8484 return (obj instanceof String str ) && !str .isEmpty ();
8585 }
8686
87+ @ Test
88+ public void testMapMultiForManagingExceptionsInParsing () {
89+ String valuesAsString = """
90+ 1
91+ 2
92+ @@@@@ buggy
93+ 3""" ;
94+
95+ var parsed = valuesAsString .lines ()
96+ .mapMultiToInt ((line , consumer ) -> {
97+ try {
98+ int i = Integer .parseInt (line );
99+ consumer .accept (i );
100+ } catch (NumberFormatException _) {}
101+ }).toArray ();
102+
103+ Assertions .assertArrayEquals (new int []{1 , 2 , 3 }, parsed );
104+ }
105+
87106 @ SuppressWarnings ({"removal" , "synchronization" })
88107 @ Test
89108 public void testValueBasedClasses () {
You can’t perform that action at this time.
0 commit comments