Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import junit.framework.TestCase;
- import org.uispec4j.*;
- /**
- * A simple test of the JTableDemo GUI using UISpec4J.
- * @author jdalbey
- */
- public class JTableDemoTest extends TestCase
- {
- public JTableDemoTest(String testName)
- {
- super(testName);
- }
- public void testOne()
- {
- JTableDemo view = new JTableDemo();
- view.layoutGUI();
- /* Note: Window and Table are UISpec4J classes */
- Window win = new Window(view);
- Table table = win.getTable("table");
- // Inspect one cell of the table
- Renderable p = (Renderable) table.getContentAt(1,1, new ModelTableCellValueConverter());
- // It should contain the piece symbol.
- assertEquals("O", p.getText());
- // make a move
- table.click(1,1);
- // See if the cell content changed
- p = (Renderable) table.getContentAt(1,1, new ModelTableCellValueConverter());
- // Empty table cells contain null.
- assertEquals(null, p);
- }
- public void testTwo()
- {
- JTableDemo view = new JTableDemo();
- view.layoutGUI();
- Window win = new Window(view);
- TextBox theLabel = win.getTextBox("status");
- assertEquals("###", theLabel.getText());
- win.getTable("table").click(1,1);
- assertEquals("1", theLabel.getText());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement