Search in sources :

Example 1 with TestException

use of org.testng.TestException in project incubator-gobblin by apache.

the class HierarchicalAckableTest method testChildNacked.

@Test
public void testChildNacked() throws Exception {
    BasicAckableForTesting ackable = new BasicAckableForTesting();
    HierarchicalAckable hierarchicalAckable = new HierarchicalAckable(Lists.newArrayList(ackable));
    Ackable child1 = hierarchicalAckable.newChildAckable();
    Ackable child2 = hierarchicalAckable.newChildAckable();
    child2.ack();
    Assert.assertEquals(ackable.acked, 0);
    Assert.assertEquals(ackable.nacked, 0);
    hierarchicalAckable.close();
    Assert.assertEquals(ackable.acked, 0);
    Assert.assertEquals(ackable.nacked, 0);
    child1.nack(new TestException("test"));
    Assert.assertEquals(ackable.acked, 0);
    Assert.assertEquals(ackable.nacked, 1);
    Assert.assertNotNull(ackable.throwable);
    Assert.assertTrue(ackable.throwable instanceof HierarchicalAckable.ChildrenFailedException);
    Assert.assertEquals(((HierarchicalAckable.ChildrenFailedException) ackable.throwable).getFailureCauses().size(), 1);
}
Also used : TestException(org.testng.TestException) Test(org.testng.annotations.Test)

Aggregations

TestException (org.testng.TestException)1 Test (org.testng.annotations.Test)1