TetrisGlass implements Glass { public void empty() { Arrays.fill(occupied, 0); for (GlassEventListener glassEventListener : glassEventListeners) { glassEventListener.glassOverflown(); } } TetrisGlass(int width, int height, GlassEventListener... glassEventListeners); boolean accept(Figure figure, int x, int y); void drop(Figure figure, int x, int y); void empty(); @Override void figureAt(Figure figure, int x, int y); @Override List<Plot> getDroppedPlots(); @Override List<Plot> getCurrentFigurePlots(); boolean isEmpty(); static final int BITS_PER_POINT; }
@Test public void shouldTriggerListenerWhenOverflow() { glass.empty(); verify(glassEventListener).glassOverflown(); }
@Test public void shouldTriggerAllListenersWhenOverflow() { TetrisGlass glass = new TetrisGlass(WIDTH, HEIGHT, glassEventListener, glassEventListener); glass.empty(); verify(glassEventListener, times(2)).glassOverflown(); }