Search in sources :

Example 66 with Anchor

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]\">");
    }
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 67 with Anchor

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>]\">");
    }
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 68 with Anchor

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");
    }
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 69 with Anchor

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());
    }
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 70 with Anchor

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]\">");
    }
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Aggregations

Anchor (com.google.gwt.user.client.ui.Anchor)90 Test (org.junit.Test)63 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)51 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)4 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)4 Image (com.google.gwt.user.client.ui.Image)4 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)4 ImageResourceRenderer (com.google.gwt.user.client.ui.ImageResourceRenderer)3 Label (com.google.gwt.user.client.ui.Label)3 RestApi (com.google.gerrit.client.rpc.RestApi)2 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)2 Grid (com.google.gwt.user.client.ui.Grid)2 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)2 InlineHTML (com.google.gwt.user.client.ui.InlineHTML)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 CenterLayout (com.extjs.gxt.ui.client.widget.layout.CenterLayout)1 AvatarImage (com.google.gerrit.client.AvatarImage)1 DiffObject (com.google.gerrit.client.DiffObject)1