@Test public void isSingleColor() { final Pie pie = new Pie(bus); assertThat(pie.isSingleColor(), is(false)); pie.tryPlacePiece(Pie.SLOT_TOP_LEFT, Piece.ORANGE); pie.tryPlacePiece(Pie.SLOT_TOP_CENTER, Piece.PURPLE); pie.tryPlacePiece(Pie.SLOT_TOP_RIGHT, Piece.PURPLE); pie.tryPlacePiece(Pie.SLOT_BOTTOM_LEFT, Piece.GREEN); pie.tryPlacePiece(Pie.SLOT_BOTTOM_CENTER, Piece.GREEN); pie.tryPlacePiece(Pie.SLOT_BOTTOM_RIGHT, Piece.PURPLE); assertThat(pie.isSingleColor(), is(false)); pie.reset(); pie.tryPlacePiece(Pie.SLOT_TOP_LEFT, Piece.ORANGE); pie.tryPlacePiece(Pie.SLOT_TOP_CENTER, Piece.ORANGE); pie.tryPlacePiece(Pie.SLOT_TOP_RIGHT, Piece.ORANGE); pie.tryPlacePiece(Pie.SLOT_BOTTOM_LEFT, Piece.ORANGE); pie.tryPlacePiece(Pie.SLOT_BOTTOM_CENTER, Piece.ORANGE); pie.tryPlacePiece(Pie.SLOT_BOTTOM_RIGHT, Piece.ORANGE); assertThat(pie.isSingleColor(), is(true)); }
@Test public void reset() { final Pie pie = new Pie(bus); assertThat(pie.isFull(), is(false)); for (@Pie.Slot int slot = Pie.SLOT_TOP_LEFT; slot < Pie.NUMBER_SLOTS; slot++) { pie.tryPlacePiece(slot, Piece.ORANGE); } assertThat(pie.isFull(), is(true)); pie.reset(); assertThat(pie.isFull(), is(false)); assertThat(occurrencesOf(events, pie.thisChanged), is(equalTo(7))); }