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) {
// Then
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 WidgetAssertTest method textEqualsWithAsAndCustomAssertionErrorMessage.
@Test
public void textEqualsWithAsAndCustomAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setText("Ben Linus");
// When
try {
GwtAssertions.assertThat(a).overridingErrorMessage("custom error message").as("my anchor").textEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[my anchor text] custom error message");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method isNotAttachedAssertionErrorMessage.
@Test
public void isNotAttachedAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
RootPanel.get().add(a);
// When
try {
GwtAssertions.assertThat(a).isNotAttached();
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[Anchor] should not be attached");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method stylePrimaryNameEqualsAssertionErrorMessage.
@Test
public void stylePrimaryNameEqualsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setStylePrimaryName("primary");
a.addStyleName("second");
// When
try {
assertThat(a).stylePrimaryNameEquals("not-my-style");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[Anchor's stylePrimaryName] expected:<\"[not-my-style]\"> but was:<\"[primary]\">");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method htmlEqualsAssertionErrorMessage.
@Test
public void htmlEqualsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setHTML("<h3>Ben Linus</h3>");
// When
try {
GwtAssertions.assertThat(a).htmlEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[Anchor's HTML] expected:<\"[John Locke]\"> but was:<\"[<h3>Ben Linus</h3>]\">");
}
}
Aggregations