@Test public void all_valid_exits_are_retrieveable() { final Exit exit1 = mockery.mock(Exit.class, "exit1"); final Exit exit2 = mockery.mock(Exit.class, "exit2"); mockery.checking( new Expectations() { { allowing(exit1).visible(); will(returnValue(true)); ignoring(exit1); allowing(exit2).visible(); will(returnValue(true)); ignoring(exit2); } }); List<Exit> exits = new ArrayList<Exit>(); exits.add(exit1); exits.add(exit2); Location l = createLocation(); l.addExit(exit1); l.addExit(exit2); assertEquals(exits, l.visibleExits()); }
@Test public void non_visible_exits_are_not_in_the_exits_list() { final Exit exit = mockery.mock(Exit.class); mockery.checking( new Expectations() { { allowing(exit).visible(); will(returnValue(false)); ignoring(exit); } }); Location l = createLocation(); l.addExit(exit); assertEquals(0, l.visibleExits().size()); }
@Test public void non_visible_exits_are_not_exitable() { final Exit exit = mockery.mock(Exit.class); mockery.checking( new Expectations() { { allowing(exit).visible(); will(returnValue(false)); ignoring(exit); } }); Location l = createLocation(); l.addExit(exit); assertFalse(l.exitable(exit)); }
@Test public void added_exit_makes_the_exit_exitable() { final Exit exit = mockery.mock(Exit.class); mockery.checking( new Expectations() { { allowing(exit).visible(); will(returnValue(true)); ignoring(exit); } }); Location l = createLocation(); l.addExit(exit); assertTrue(l.exitable(exit)); }