### Question:
EventSheet { public void removeRule(GameRule aGameRule) { List<GameRule> theRules = ArrayUtils.asList(rules); theRules.remove(aGameRule); rules = theRules.toArray(new GameRule[theRules.size()]); } EventSheet(GameScene aGameScene); GameScene getGameScene(); Property<String> nameProperty(); GameRule[] getRules(); Map<String, Object> serialize(); static EventSheet unmarshall(IORegistry aIORegistry, GameScene aGameScene, Map<String, Object> aSerializedData); void addRule(GameRule aNewRule); void removeRule(GameRule aGameRule); static final String NAME_PROPERTY; }### Answer:
@Test public void testRemoveRule() throws Exception { GameScene theScene = mock(GameScene.class); GameRuntime theRuntime = mock(GameRuntime.class); GameEventManager theManager = mock(GameEventManager.class); when(theScene.getRuntime()).thenReturn(theRuntime); when(theRuntime.getEventManager()).thenReturn(theManager); EventSheet theSheet = new EventSheet(theScene); GameRule theRule = new GameRule(); theSheet.addRule(theRule); assertEquals(1, theSheet.getRules().length); assertSame(theRule, theSheet.getRules()[0]); theSheet.removeRule(theRule); assertEquals(0, theSheet.getRules().length); }