@Test public void testShouldCauseTheLoadMethodToBeCalledIfTheComponentIsNotAlreadyLoaded() { LoadsOk ok = new LoadsOk(true); ok.get(); assertTrue(ok.wasLoadCalled()); }
@Test public void testShouldThrowAnErrorIfCallingLoadDoesNotCauseTheComponentToLoad() { LoadsOk ok = new LoadsOk(false); try { ok.get(); fail(); } catch (Error e) { assertEquals("Expected failure", e.getMessage()); } }