use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method htmlEquals.
@Test
public void htmlEquals() {
// Given
Anchor a = new Anchor();
a.setHTML("<h3>Ben Linus</h3>");
// When
try {
GwtAssertions.assertThat(a).htmlEquals("<h3>Ben Linus</h3>");
} 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 styleNameEqualsAssertionErrorMessage.
@Test
public void styleNameEqualsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setStyleName("first");
a.addStyleName("second");
// When
try {
assertThat(a).styleNameEquals("not-my-style");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
assertThat(e.getMessage()).isEqualTo("[Anchor's styleName] expected:<\"[not-my-style]\"> but was:<\"[first second]\">");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method titleEqualsWithAsAndCustomAssertionErrorMessage.
@Test
public void titleEqualsWithAsAndCustomAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setTitle("Lost 108");
// When
try {
GwtAssertions.assertThat(a).overridingErrorMessage("custom error message").as("my anchor").titleEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
assertThat(e.getMessage()).isEqualTo("[my anchor title] 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 hasStyle.
@Test
public void hasStyle() {
// Given
Anchor a = new Anchor();
a.setStyleName("first-style");
a.addStyleName("second-style");
a.addStyleName("third-style");
// When
try {
assertThat(a).hasStyle("first-style", "second-style", "third-style");
} 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 titleEqualsWithAsAssertionErrorMessage.
@Test
public void titleEqualsWithAsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setTitle("Lost 108");
// When
try {
GwtAssertions.assertThat(a).as("my anchor").titleEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
assertThat(e.getMessage()).isEqualTo("[my anchor title] expected:<\"[John Locke]\"> but was:<\"[Lost 108]\">");
}
}
Aggregations