Methods Summary |
---|
protected void | setUp()
this.emptyPanel = new PersonEditorPanel();
this.tanner = new Person("Tanner", "Burke");
this.tannerPanel = new PersonEditorPanel();
this.tannerPanel.setPerson(this.tanner);
getTestFrame().getContentPane().add(this.tannerPanel, BorderLayout.CENTER);
getTestFrame().pack();
getTestFrame().show();
|
public static junit.framework.Test | suite()
return new RepeatedTest(new TestSuite(TestPersonEditorPanel.class), 1000);
|
public void | testEnabledStateAfterSettingPerson()
assertTrue("First name field should be enabled",
this.tannerPanel.getFirstNameField().isEnabled());
assertTrue("Last name field should be enabled",
this.tannerPanel.getLastNameField().isEnabled());
|
public void | testFirstName()
assertEquals("First name", "",
this.emptyPanel.getFirstNameField().getText());
assertEquals("First name", this.tanner.getFirstName(),
this.tannerPanel.getFirstNameField().getText());
|
public void | testLastName()
assertEquals("Last name", "",
this.emptyPanel.getLastNameField().getText());
assertEquals("Last name", this.tanner.getLastName(),
this.tannerPanel.getLastNameField().getText());
|
public void | testTabOrder()
JTextField firstNameField = this.tannerPanel.getFirstNameField();
// make sure the first name field has focus
while (!firstNameField.hasFocus()) {
getTestFrame().toFront();
firstNameField.requestFocusInWindow();
}
// simulate the user hitting tab
firstNameField.transferFocus();
// wait until the transferFocus() method is processed
waitForSwing();
// ensure that the last name field now has focus
JTextField lastNameField = this.tannerPanel.getLastNameField();
assertTrue("Expected last name field to have focus",
lastNameField.hasFocus());
|
public void | testTextFieldsAreInitiallyDisabled()
assertTrue("First name field should be disabled",
!this.emptyPanel.getFirstNameField().isEnabled());
assertTrue("Last name field should be disabled",
!this.emptyPanel.getLastNameField().isEnabled());
|