package jpower.core.test;

import jpower.core.Wrapper;
import jpower.core.utils.CallUtils;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public class CallUtilsTest
{
   @Test
   public void testTryCatch()
   {
      Wrapper<Throwable> caught = new Wrapper<>(null);
      CallUtils.tryCatch(() -> {
         throw new Exception("This should be caught");
      }, caught::set);
      CallUtils.tryCatch(() -> {
         throw new Exception("LOL");
      }, Throwable::printStackTrace);
      assertNotNull(caught.get());
      assertEquals("This should be caught", caught.get().getMessage());
   }

   @Test
   public void testCallIgnoreExceptions()
   {
      CallUtils.callIgnoreExceptions(() -> {
         throw new Exception("SHOULD BE IGNORED");
      });
   }
}

@@ -499,116 +499,8 @@
 t);%0A
-      CallUtils.tryCatch(() -%3E %7B%0A         throw new Exception(%22LOL%22);%0A      %7D, Throwable::printStackTrace);%0A
     

Remove a debugging call.