We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 24012bd commit cfb361dCopy full SHA for cfb361d
1 file changed
src/test/java/com/github/lokic/javaplus/functional/sneakythrows/SneakyThrowFunctionalTest.java
@@ -0,0 +1,27 @@
1
+package com.github.lokic.javaplus.functional.sneakythrows;
2
+
3
+import org.assertj.core.util.Lists;
4
+import org.junit.Assert;
5
+import org.junit.Test;
6
7
+import java.io.IOException;
8
+import java.util.List;
9
+import java.util.stream.Collectors;
10
+import java.util.stream.Stream;
11
12
+public class SneakyThrowFunctionalTest {
13
14
+ @Test
15
+ public void cast() {
16
+ List<String> re = Stream.of(1, 2)
17
+ .map(SneakyThrowFunctional.cast(this::toStr))
18
+ .collect(Collectors.toList());
19
20
+ Assert.assertEquals(Lists.newArrayList("1", "2"), re);
21
+ }
22
23
24
+ public String toStr(Integer x) throws IOException {
25
+ return String.valueOf(x);
26
27
+}
0 commit comments