예제 #1
0
 @Test
 public void TestSetCellAt() {
   System.out.println("setCellAt");
   instance.setCellAt("X", 0, 0);
   Object expResult = "X";
   Object result = ((ImageIcon) instance.getValueAt(0, 0)).getDescription();
   assertEquals(expResult, result);
 }
예제 #2
0
 @Test
 public void TestClickOnGridAt() {
   System.out.println("clickOnGridAt");
   instance.clickOnGridAt(0, 0, "X");
   Object expResult = "X";
   Object result = instance.getCellAt(0, 0);
   assertEquals(expResult, result);
 }
예제 #3
0
 @Test
 public void testGetInverse() {
   System.out.println("getInverse");
   instance.setCellAt("X", 0, 2);
   instance.setCellAt("O", 1, 1);
   String expResult = "XO ";
   String result = instance.getInverse();
   assertEquals(expResult, result);
 }
예제 #4
0
  @Test
  public void testClear() {
    System.out.println("clear");
    instance.setCellAt("X", 0, 0);

    Object expResult = null;
    instance.clear();
    Object result = instance.getCellAt(0, 0);
    assertEquals(expResult, result);
  }
예제 #5
0
 @Test
 public void testGetColumn() {
   System.out.println("getColumn");
   int j = 0;
   instance.setCellAt("X", 0, j);
   instance.setCellAt("O", 1, j);
   String expResult = "XO ";
   String result = instance.getColumn(j);
   assertEquals(expResult, result);
 }
예제 #6
0
 @Test
 public void testGetRow() {
   System.out.println("getRow");
   int i = 0;
   instance.setCellAt("X", i, 0);
   instance.setCellAt("O", i, 1);
   String expResult = "XO ";
   String result = instance.getRow(i);
   assertEquals(expResult, result);
 }
예제 #7
0
 @Test
 public void testTableIsFull() {
   System.out.println("tableIsFull");
   int count = instance.getRowCount();
   for (int i = 0; i < count; i++) {
     for (int j = 0; j < count; j++) {
       instance.setCellAt("X", i, j);
     }
   }
   boolean result = instance.tableIsFull();
   assertTrue(result);
 }
예제 #8
0
 @Test
 public void TestGetCellAt() {
   System.out.println("getCellAt");
   Image image =
       Toolkit.getDefaultToolkit().createImage(getClass().getResource("resources/x-icon.gif"));
   ImageIcon icon = new ImageIcon(image);
   icon.setDescription("X");
   instance.setValueAt(icon, 0, 0);
   String expResult = "X";
   String result = instance.getCellAt(0, 0);
   assertEquals(expResult, result);
 }