### Question:
Numbers { public boolean canGo(Mirror data) { for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { if (data.get(x, y) == NONE) { return true; } } for (int y1 = 0; y1 < size - 1; y1++) { int y2 = y1 + 1; int n1 = data.get(x, y1); int n2 = data.get(x, y2); if (n1 != BREAK && n1 == n2) { return true; } } } return false; } Numbers(List<Number> numbers, int size, List<Number> aBreak);  Numbers(int[][] numbers);  Numbers(int size); void clear(); boolean isEmpty(); void add(int x, int y, int number); void add(Number number); Number get(int x, int y); boolean contains(Elements element); boolean isBusy(int x, int y); void remove(Point pt); @Override String toString(); boolean canGo(Mirror data); boolean canGo(); boolean isFull(); int getSum(); int freeSpace(); void move(Direction direction); int size(); static final int NONE; static final int BREAK; }### Answer:
@Test public void shouldCanGo_horizontal() { Numbers numbers = new Numbers( Arrays.asList( new Number(4, pt(0, 0)), new Number(2, pt(0, 1)), new Number(4, pt(1, 0)), new Number(2, pt(1, 1))), 2, EMPTY); assertN("22" + "44", numbers); assertEquals(true, numbers.canGo()); }
@Test public void shouldCanGo_vertical() { Numbers numbers = new Numbers( Arrays.asList( new Number(4, pt(0, 0)), new Number(4, pt(0, 1)), new Number(2, pt(1, 0)), new Number(2, pt(1, 1))), 2, EMPTY); assertN("42" + "42", numbers); assertEquals(true, numbers.canGo()); }
@Test public void shouldCanGo_whenEmpty() { Numbers numbers = new Numbers( Arrays.asList( new Number(4, pt(0, 0)), new Number(2, pt(1, 0)), new Number(4, pt(1, 1))), 2, EMPTY); assertN(".4" + "42", numbers); assertEquals(true, numbers.canGo()); }
@Test public void shouldCantGo_withoutBreaks() { Numbers numbers = new Numbers( Arrays.asList( new Number(4, pt(0, 0)), new Number(2, pt(0, 1)), new Number(2, pt(1, 0)), new Number(4, pt(1, 1))), 2, EMPTY); assertN("24" + "42", numbers); assertEquals(false, numbers.canGo()); }
@Test public void shouldCantGo_withBreaksVertical() { Numbers numbers = new Numbers( Arrays.asList( new Number(4, pt(0, 0)), new Number(2, pt(0, 1))), 2, Arrays.asList( new Number(Numbers.BREAK, pt(1, 0)), new Number(Numbers.BREAK, pt(1, 1)))); assertN("2x" + "4x", numbers); assertEquals(false, numbers.canGo()); }
@Test public void shouldCantGo_withBreaksHorizontal() { Numbers numbers = new Numbers( Arrays.asList( new Number(4, pt(1, 0)), new Number(2, pt(0, 0))), 2, Arrays.asList( new Number(Numbers.BREAK, pt(0, 1)), new Number(Numbers.BREAK, pt(1, 1)))); assertN("xx" + "24", numbers); assertEquals(false, numbers.canGo()); }