36 |
cb.invoke( new FailingInvocation() ); |
cb.invoke( new FailingInvocation() ); |
37 |
} |
} |
38 |
|
|
39 |
@Test public void failingTest() throws Throwable { |
@Test public void failingTest() { |
40 |
try { |
try { |
41 |
cb.invoke( new FailingInvocation() ); |
cb.invoke( new FailingInvocation() ); |
42 |
}catch (Throwable t) {} |
}catch (Throwable t) {} |
43 |
assertTrue(cb.getFailureCount() == 1); |
assertTrue(cb.getFailureCount() == 1); |
44 |
} |
} |
45 |
|
|
46 |
|
@Test public void failAndResetTest() throws Throwable { |
47 |
|
try { |
48 |
|
cb.invoke( new FailingInvocation() ); |
49 |
|
}catch (Throwable t) {} |
50 |
|
|
51 |
|
cb.invoke(new SucceedingInvocation() ); //after one good it should reset back to closed |
52 |
|
|
53 |
|
assertTrue(cb.isClosed()); |
54 |
|
assertTrue(cb.getFailureCount() == 0); |
55 |
|
} |
56 |
|
|
57 |
@Test public void normalOpenTest() throws Throwable { |
@Test public void normalOpenTest() throws Throwable { |
58 |
try{ |
try{ |
59 |
cb.invoke( new FailingInvocation() ); |
cb.invoke( new FailingInvocation() ); |
63 |
cb.invoke( new FailingInvocation() ); |
cb.invoke( new FailingInvocation() ); |
64 |
} catch (IOException e) {} |
} catch (IOException e) {} |
65 |
|
|
66 |
assertTrue( cb.getStateName().equalsIgnoreCase("open") ); |
assertTrue( cb.isOpen() ); |
67 |
|
} |
68 |
|
|
69 |
|
@Test public void forcedResetTest() throws Throwable { |
70 |
|
try{ |
71 |
|
cb.invoke( new FailingInvocation() ); |
72 |
|
} catch (IOException e) {} |
73 |
|
|
74 |
|
try{ |
75 |
|
cb.invoke( new FailingInvocation() ); |
76 |
|
} catch (IOException e) {} |
77 |
|
|
78 |
|
cb.reset(); |
79 |
|
|
80 |
|
assertTrue( cb.isClosed() ); |
81 |
} |
} |
82 |
|
|
83 |
} |
} |