FigureTypesLevel implements GameLevel { @Override public String getNextLevelIngoingCriteria() { switch (event.getType()) { case LINES_REMOVED : return String.format("Remove %s lines together", event.getValue()); case TOTAL_LINES_REMOVED : return String.format("Remove %s lines", event.getValue()); case WITHOUT_OVERFLOWN_LINES_REMOVED : return String.format("Remove %s lines without overflown", event.getValue()); } return NullGameLevel.THIS_IS_LAST_LEVEL; } FigureTypesLevel(PlayerFigures figuresQueue, GlassEvent event, Figure.Type... figureTypesToOpen); @Override boolean accept(GlassEvent event); @Override void apply(); @Override String getNextLevelIngoingCriteria(); @Override FigureQueue getFigureQueue(); @Override int getFigureTypesToOpenCount();  }
@Test public void validateNextLevelIngoingCriteria() { PlayerFigures queue = mock(PlayerFigures.class); assertEquals("Remove 4 lines together", new FigureTypesLevel(queue, new GlassEvent(LINES_REMOVED, 4)).getNextLevelIngoingCriteria()); assertEquals("Remove 13 lines", new FigureTypesLevel(queue, new GlassEvent(TOTAL_LINES_REMOVED, 13)).getNextLevelIngoingCriteria()); assertEquals("This is last level", new FigureTypesLevel(queue, new GlassEvent(FIGURE_DROPPED, 0)).getNextLevelIngoingCriteria()); assertEquals("This is last level", new NullGameLevel().getNextLevelIngoingCriteria()); assertEquals("Remove 77 lines without overflown", new FigureTypesLevel(queue, new GlassEvent(WITHOUT_OVERFLOWN_LINES_REMOVED, 77)).getNextLevelIngoingCriteria()); }