示例#1
0
 @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();
         }
       });
 }
示例#2
0
 @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");
         }
       });
 }
示例#3
0
 @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");
         }
       });
 }
示例#4
0
 @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");
         }
       });
 }
示例#5
0
 @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);
         }
       });
 }