phamow / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

[fest-assert] StringAssert enhancements #78

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
----------------------
in StringAssert
----------------------

  /**
   * Verifies that the actual <code>String</code> dones not contains the
given one.
   * @param expected the given <code>String</code> expected not to be
contained in the actual one.
   * @return this assertion object.
   * @throws AssertionError if the actual <code>String</code> does contain
the given one.
   */
  public StringAssert doesNotContains(String expected) {
    if (actual.indexOf(expected) != -1) 
      fail(concat(format(description()), "the String ", quote(actual), "
should not contain the String ", quote(expected)));
    return this;
  }

----------------------
in StringAssertTest
----------------------

  public void shouldSucceedIfStringDoesNotContainGivenString() {
    new StringAssert("Luke").doesNotContains("Yoda");
  }

  @Test(expectedExceptions = AssertionError.class)
   public void shouldFailIfStringContainsGivenString() {
    new StringAssert("Anakin").doesNotContains("akin");
  } 

Original issue reported on code.google.com by cinconn...@gmail.com on 20 Dec 2007 at 2:22

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Added method 'excludes' to StringAssert. Chose name 'excludes' to keep 
consistency
with ArrayAssert and CollectionAssert.

Original comment by wanghy1...@gmail.com on 23 Dec 2007 at 11:56

GoogleCodeExporter commented 9 years ago
Set the module as a label, instead of being part of the title.

Original comment by Alex.Rui...@gmail.com on 1 Dec 2008 at 1:42