コード例 #1
0
  @Test
  public void testMessageAccessors() {
    String message = "WConfirmationButton_Test.testMessageAccessors";

    WConfirmationButton button = new WConfirmationButton();
    button.setMessage(message);
    Assert.assertEquals("Incorrect message", message, button.getMessage());
  }
コード例 #2
0
  @Test
  public void testConstructors() {
    final String buttonText = "WConfirmationButton_Test.testConstructors.buttonText";
    final char accessKey = 'A';

    WConfirmationButton button = new WConfirmationButton();
    Assert.assertNull("Button text should be null", button.getText());
    Assert.assertNull("Access key should be null", button.getAccessKeyAsString());

    button = new WConfirmationButton(buttonText);
    Assert.assertEquals("Incorrect button text", buttonText, button.getText());
    Assert.assertNull("Access key should be null", button.getAccessKeyAsString());

    button = new WConfirmationButton(buttonText, accessKey);
    Assert.assertEquals("Incorrect button text", buttonText, button.getText());
    Assert.assertEquals("Incorrect access key", accessKey, button.getAccessKey());
  }