Levels implements GlassEventListener { @Override public void glassOverflown() { applyLevelIfAccepted(new GlassEvent<Void>(GlassEvent.Type.GLASS_OVERFLOW, null)); } Levels(GameLevel ... levels); @Override void glassOverflown(); GameLevel getNextLevel(); @Override void linesRemoved(int amount); @Override void figureDropped(Figure figure); GameLevel getCurrentLevel(); int getCurrentLevelNumber(); void setChangeLevelListener(ChangeLevelListener changeLevelListener); int getTotalRemovedLines();  }
@Test public void shouldNotApplyLevelWhenLevelIsApplied() { acceptLevels(true, false); levels.glassOverflown(); acceptLevels(true, true); levels.glassOverflown(); verify(level1, times(1)).accept(Matchers.<GlassEvent>anyObject()); verify(level1, times(1)).apply(); verify(level2, times(1)).apply(); }