Refactor LambdaExceptionWrappersTest
This commit is contained in:
parent
0aa46996a6
commit
7f8ee6f118
@ -1,12 +1,12 @@
|
|||||||
package com.baeldung.java8.lambda.exceptions;
|
package com.baeldung.java8.lambda.exceptions;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static com.baeldung.java8.lambda.exceptions.LambdaExceptionWrappers.*;
|
import static com.baeldung.java8.lambda.exceptions.LambdaExceptionWrappers.*;
|
||||||
|
|
||||||
public class LambdaExceptionWrappersTest {
|
public class LambdaExceptionWrappersTest {
|
||||||
@ -38,7 +38,7 @@ public class LambdaExceptionWrappersTest {
|
|||||||
integers.forEach(handlingConsumerWrapper(i -> writeToFile(i), IOException.class));
|
integers.forEach(handlingConsumerWrapper(i -> writeToFile(i), IOException.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeToFile(Integer i) throws IOException {
|
private void writeToFile(Integer i) throws IOException {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
throw new IOException(); // mock IOException
|
throw new IOException(); // mock IOException
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user