@Test public void checkedCodeBlockCheckedException() { Verify.assertThrowsWithCause( RuntimeException.class, IOException.class, new Runnable() { public void run() { CheckedGenerator<String> function = new CheckedGenerator<String>() { @Override public String safeValue() throws IOException { throw new IOException("fail"); } }; function.value(); } }); }
@Test public void checkedFunction2CheckedException() { Verify.assertThrowsWithCause( RuntimeException.class, IOException.class, new Runnable() { public void run() { CheckedFunction2<String, String, String> block = new CheckedFunction2<String, String, String>() { @Override public String safeValue(String argument1, String argument2) throws IOException { throw new IOException("fail"); } }; block.value("1", "2"); } }); }
@Test public void checkedPredicate2CheckedException() { Verify.assertThrowsWithCause( RuntimeException.class, IOException.class, new Runnable() { public void run() { CheckedPredicate2<String, String> block = new CheckedPredicate2<String, String>() { @Override public boolean safeAccept(String object, String param) throws IOException { throw new IOException("fail"); } }; block.accept("1", "2"); } }); }
@Test public void checkedProcedure2CheckedException() { Verify.assertThrowsWithCause( RuntimeException.class, IOException.class, new Runnable() { public void run() { CheckedProcedure2<String, String> block = new CheckedProcedure2<String, String>() { @Override public void safeValue(String object, String parameter) throws IOException { throw new IOException("fail"); } }; block.value("1", "2"); } }); }
@Test public void checkedObjectIntProcedureCheckedException() { Verify.assertThrowsWithCause( RuntimeException.class, IOException.class, new Runnable() { public void run() { CheckedObjectIntProcedure<String> block = new CheckedObjectIntProcedure<String>() { @Override public void safeValue(String object, int index) throws IOException { throw new IOException("fail"); } }; block.value("1", 1); } }); }