EndlessGrid implements Grid<T>, Overseer { int normalizeX(int x) { while (x < 0) { x += sizeX; } while (x >= sizeX) { x -= sizeX; } return x; } EndlessGrid(int sizeX, int sizeY, CellFactory<T> cellFactory);  EndlessGrid(Grid<T> other, CellFactory<T> cellFactory); protected  EndlessGrid(Parcel in); @Override void putCell(T cell); @Override void onCellStateChanged(CellStateChange cellStateChange); @Override int getSizeX(); @Override int getSizeY(); @Override T getCell(int x, int y); @Override boolean equals(Object o); @Override int hashCode(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); static final Creator<EndlessGrid> CREATOR; }
@Test public void testNormalizeX() { assertThat(grid.normalizeX(-5)).isEqualTo(1); }