@Test public void shouldReturnRightNumberOfElems() { Glass glass = new Glass( " * * * * "); assertEquals(4, glass.numbOfElemsOnField()); }
public void setModal(boolean modal) { if (modal != dialogBox.isModal()) { if (isShowing()) { if (modal) glass.show(); else glass.hide(); } dialogBox.setModal(modal); } }
@Test public void shouldInitializeGlassCorrectly() { Glass glass = new Glass( " * * * * "); assertEquals( "| |\n| |\n| |\n| |\n| |\n| |\n| |\n| |\n| |\n" + "| |\n| |\n| |\n| |\n| |\n| |\n| |\n| * |\n| * |\n| * |\n| * |\n------------", glass.toString()); }
@Test public void shouldReturnRightSufrace() { Glass glass = new Glass( " * * * * "); int[] surf = glass.getSurface(); int[] shouldBe = new int[] {0, 0, 0, 4, -4, 0, 0, 0, 0}; for (int i = 0; i < surf.length; i++) { assertEquals(shouldBe[i], surf[i]); } }
public void show() { if (isShowing()) return; if (inicialized == false) { initContent(contentPanel); initActionButton(); inicialized = true; } else cleanUp(); if (isModal()) glass.show(); dialogBox.setVisible(false); dialogBox.show(); showTimer.schedule(1); }
protected void afterHide(boolean autoHiden) { if (isModal()) glass.hide(); }
private OngoingStubbing<Boolean> rejectWhenCoordinates(int x, int y) { return when(glass.accept(Matchers.<Figure>anyObject(), eq(x), eq(y))).thenReturn(false); }
private void glassToAccept(boolean accept) { when(glass.accept(Matchers.<Figure>anyObject(), anyInt(), anyInt())).thenReturn(accept); }