use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method titleEqualsAssertionErrorMessage.
@Test
public void titleEqualsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setTitle("Lost 108");
// When
try {
GwtAssertions.assertThat(a).titleEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[Anchor's title] expected:<\"[John Locke]\"> but was:<\"[Lost 108]\">");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method htmlEqualsAssertionErrorMessageWithPrefix.
@Test
public void htmlEqualsAssertionErrorMessageWithPrefix() {
// Given
Anchor a = new Anchor();
a.setHTML("<h3>Ben Linus</h3>");
// When
try {
GwtAssertions.assertThat(a).withPrefix("my prefix").htmlEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[my prefix Anchor's HTML] expected:<\"[John Locke]\"> but was:<\"[<h3>Ben Linus</h3>]\">");
}
}
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) {
// Then
assertThat(e.getMessage()).isEqualTo("[Anchor's stylePrimaryName] my custom error");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method stylePrimaryNameEquals.
@Test
public void stylePrimaryNameEquals() {
// Given
Anchor a = new Anchor();
a.setStylePrimaryName("primary");
a.addStyleName("second");
// When & Then
try {
assertThat(a).stylePrimaryNameEquals("primary");
} 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 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) {
// Then
assertThat(e.getMessage()).isEqualTo("[Anchor's text] expected:<\"[John Locke]\"> but was:<\"[Ben Linus]\">");
}
}
Aggregations