### Question:
GlassImpl implements Glass { public boolean accept(Figure figure, int x, int y) { if (isOutside(figure, x, y)) { return false; } BigInteger[] aligned = alignRowWithGlass(figure, x, true); boolean occupied = false; for (int i = 0; i < aligned.length; i++) { BigInteger figureLine = aligned[i]; int pos = y - i + figure.top(); if (pos >= height) { continue; } BigInteger line = this.occupied.get(pos); occupied |= (line.and(figureLine).compareTo(BigInteger.ZERO) == 1); } return !occupied; } GlassImpl(int width, int height, Supplier<Integer> supplier); 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> dropped(); @Override List<Plot> currentFigure(); @Override boolean isEmpty(); @Override void setListener(EventListener listener); @Override Glass clone(); static final int BITS; static final BigInteger Ob111; }### Answer:
@Test public void shouldAcceptWhenEmpty() { assertTrue(glass.accept(new FigureImpl(), 1, 1)); }
@Test public void shouldRejectWhenFigurePartlyOutsideFromLeft() { assertFalse(glass.accept(new FigureImpl(1, 0, "##"), 0, HEIGHT)); }
@Test public void shouldRejectWhenFigurePartlyOutsideFromRight() { assertFalse(glass.accept(new FigureImpl(0, 0, "##"), WIDTH, HEIGHT)); }
@Test public void shouldRejectWhenFigurePartlyOutsideBottom() { assertFalse(glass.accept(new FigureImpl(0, 0, "#", "#"), WIDTH, 0)); }
@Test public void shouldRejectWhenPartiallyOutsideOnRight() { assertFalse(glass.accept(new FigureImpl(0, 0, "##"), WIDTH - 1, 0)); }