ContextWrapperStatement extends Statement { @Override public void evaluate() throws Throwable { testContext.configureTest(testObj); junitStatement.evaluate(); } ContextWrapperStatement(TestContext testContext, Statement junitStatement, Object testObj); @Override void evaluate();  }
@Test public void testEvaluate() throws Throwable { configuredInvoked = false; statementInvoked = false; ContextWrapperStatement wrapper = new ContextWrapperStatement(new FakeTestContext(false), new FakeStatement(false), fakeTestObject); wrapper.evaluate(); assertTrue(configuredInvoked); assertTrue(statementInvoked); }
@Test public void testEvaluateFailStatement() throws Throwable { configuredInvoked = false; statementInvoked = false; ContextWrapperStatement wrapper = new ContextWrapperStatement(new FakeTestContext(false), new FakeStatement(true), fakeTestObject); try { wrapper.evaluate(); fail("Wrapper call succeeded."); } catch (Throwable e) { } assertTrue(configuredInvoked); assertFalse(statementInvoked); }
@Test public void testEvaluateFailConfigure() throws Throwable { configuredInvoked = false; statementInvoked = false; ContextWrapperStatement wrapper = new ContextWrapperStatement(new FakeTestContext(true), new FakeStatement(false), fakeTestObject); try { wrapper.evaluate(); fail("Wrapper call succeeded."); } catch (Throwable e) { } assertFalse(configuredInvoked); assertFalse(statementInvoked); }