Skip to content

Commit cfb361d

Browse files
committed
test: add tests
1 parent 24012bd commit cfb361d

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)