Ejemplo n.º 1
0
  @Test
  public void testEndsWith() {
    // GIVEN
    String expected = "value";
    String actual = "test value";

    // WHEN / THEN
    GAssert.assertEndsWith(expected, actual);
  }
Ejemplo n.º 2
0
  @Test
  public void testEndsWith_fail_toShort() {
    // GIVEN
    String expected = "";
    String actual = "test value";

    try {
      // WHEN
      GAssert.assertEndsWith(expected, actual);
      fail();
    } catch (AssertionError e) {
      // THEN
      assertEquals(
          "expected value: \"\" is too short expected:<[]> but was:<[test value]>", e.getMessage());
    }
  }
Ejemplo n.º 3
0
  @Test
  public void testEndsWith_actualToShort_fail() {
    // GIVEN
    String expected = "test";
    String actual = "lue";

    try {
      // WHEN
      GAssert.assertEndsWith(expected, actual);
      fail();
    } catch (ComparisonFailure e) {
      // THEN
      assertEquals(
          "Expected: a string ending with \"test\"\n" //
              + "     but: was \"lue\" expected:<[test]> but was:<[lue]>",
          e.getMessage());
    }
  }