public void testAlwaysTrueForThrowable() { RollbackRuleAttribute rr = new RollbackRuleAttribute("java.lang.Throwable"); assertTrue(rr.getDepth(new MailSendException("")) > 0); assertTrue(rr.getDepth(new ServletException()) > 0); assertTrue(rr.getDepth(new FatalBeanException(null, null)) > 0); assertTrue(rr.getDepth(new RuntimeException()) > 0); }
public void testAlwaysTrueForThrowable() { RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Throwable.class.getName()); assertTrue(rr.getDepth(new MyRuntimeException("")) > 0); assertTrue(rr.getDepth(new IOException()) > 0); assertTrue(rr.getDepth(new FatalBeanException(null, null)) > 0); assertTrue(rr.getDepth(new RuntimeException()) > 0); }
public void testAncestry() { RollbackRuleAttribute rr = new RollbackRuleAttribute("java.lang.Exception"); // Exception -> Runtime -> NestedRuntime -> MailException -> MailSendException assertTrue(rr.getDepth(new MailSendException("")) == 4); }
public void testNotFound() { RollbackRuleAttribute rr = new RollbackRuleAttribute("javax.servlet.ServletException"); assertTrue(rr.getDepth(new MailSendException("")) == -1); }
public void testFoundImmediatelyWithClass() { RollbackRuleAttribute rr = new RollbackRuleAttribute(Exception.class); assertTrue(rr.getDepth(new Exception()) == 0); }
public void testFoundImmediatelyWithString() { RollbackRuleAttribute rr = new RollbackRuleAttribute("java.lang.Exception"); assertTrue(rr.getDepth(new Exception()) == 0); }
public void testAncestry() { RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName()); // Exception -> Runtime -> NestedRuntime -> MyRuntimeException assertThat(rr.getDepth(new MyRuntimeException("")), equalTo(3)); }
public void testNotFound() { RollbackRuleAttribute rr = new RollbackRuleAttribute(java.io.IOException.class.getName()); assertTrue(rr.getDepth(new MyRuntimeException("")) == -1); }