use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method textEqualsAssertionErrorMessage.
@Test
public void textEqualsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setText("Ben Linus");
// When
try {
GwtAssertions.assertThat(a).textEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
assertThat(e.getMessage()).isEqualTo("[Anchor's text] expected:<\"[John Locke]\"> but was:<\"[Ben Linus]\">");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method styleNameEqualsWithAsAndCustomAssertionErrorMessage.
@Test
public void styleNameEqualsWithAsAndCustomAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setStyleName("first");
a.addStyleName("second");
// When
try {
assertThat(a).as("my anchor").overridingErrorMessage("custom error message").styleNameEquals("not-my-style");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
assertThat(e.getMessage()).isEqualTo("[my anchor styleName] custom error message");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class StackPanelTest method click.
@Test
public void click() {
// Given
index = -1;
StackPanel panel = new StackPanel() {
@Override
public void showStack(int index) {
StackPanelTest.this.index = index;
}
;
};
panel.add(new Anchor());
panel.add(new Anchor());
// When
Browser.click(panel, 1);
// Then
assertThat(index).isEqualTo(1);
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method isVisibleWithAsAssertionErrorMessage.
@Test
public void isVisibleWithAsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setVisible(false);
// When
try {
GwtAssertions.assertThat(a).as("my anchor").isVisible();
fail("AssertionError should be thrown");
} catch (AssertionError e) {
assertThat(e.getMessage()).isEqualTo("[my anchor] should be visible");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method stylePrimaryNameEqualsWithCustomAssertionErrorMessage.
@Test
public void stylePrimaryNameEqualsWithCustomAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setStylePrimaryName("primary");
a.addStyleName("second");
// When
try {
assertThat(a).overridingErrorMessage("my custom error").stylePrimaryNameEquals("not-my-style");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
assertThat(e.getMessage()).isEqualTo("[Anchor's stylePrimaryName] my custom error");
}
}
Aggregations