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) {
// Then
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 textEqualsWithAsAssertionErrorMessage.
@Test
public void textEqualsWithAsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setText("Ben Linus");
// When
try {
GwtAssertions.assertThat(a).as("my anchor").textEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[my anchor 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 isAttached.
@Test
public void isAttached() {
// Given
Anchor a = new Anchor();
RootPanel.get().add(a);
// When & Then
try {
assertThat(a).isAttached();
} catch (AssertionError e) {
fail("assertion should pass but failed with message : " + e.getMessage());
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method isNotAttachedWithCustomAssertionErrorMessage.
@Test
public void isNotAttachedWithCustomAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
RootPanel.get().add(a);
// When
try {
GwtAssertions.assertThat(a).overridingErrorMessage("custom failure").isNotAttached();
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[Anchor] custom failure");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method isNotAttachedWithAsAndCustomAssertionErrorMessage.
@Test
public void isNotAttachedWithAsAndCustomAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
RootPanel.get().add(a);
// When
try {
GwtAssertions.assertThat(a).as("my anchor").overridingErrorMessage("custom failure").isNotAttached();
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[my anchor] custom failure");
}
}
Aggregations