示例#1
0
 @Test
 public void codeBlockSuccess() {
   Generator<Object> function =
       new CheckedGenerator<Object>() {
         @Override
         public Object safeValue() {
           return null;
         }
       };
   MutableMap<String, Object> values = UnifiedMap.newMap();
   MapIterate.getIfAbsentPut(values, "test", function);
 }
示例#2
0
 @Test(expected = RuntimeException.class)
 public void codeBlockRuntimeException() {
   Generator<Object> function =
       new CheckedGenerator<Object>() {
         @Override
         public Object safeValue() {
           throw new RuntimeException();
         }
       };
   MutableMap<String, Object> values = UnifiedMap.newMap();
   MapIterate.getIfAbsentPut(values, "test", function);
 }