Package org.fest.assertions.description

Examples of org.fest.assertions.description.Description


    strings.assertMatches(mock(Description.class), null, Pattern.compile(".*"));
  }

  @Test
  public void should_fail_if_actual_does_not_match_regular_expression() {
    Description description = new TestDescription("Testing");
    try {
      strings.assertMatches(description, "Yoda", Pattern.compile("Luke"));
    } catch (AssertionError e) {
      assertEquals("[Testing] expecting:<'Yoda'> to match regular expression:<'Luke'>", e.getMessage());
      verify(failures).failure(same(description), any(ErrorMessageFactory.class));
View Full Code Here


    strings.assertEmpty(mock(Description.class), null);
  }

  @Test
  public void should_fail_if_actual_is_not_empty() {
    Description description = new TestDescription("Testing");
    try {
      strings.assertEmpty(description, "Yoda");
    } catch (AssertionError e) {
      assertEquals("[Testing] expecting:\n empty but was:<'Yoda'>", e.getMessage());
      verify(failures).failure(same(description), any(ErrorMessageFactory.class));
View Full Code Here

    strings.assertStartsWith(mock(Description.class), null, "Yoda");
  }

  @Test
  public void should_fail_if_actual_does_not_start_with_prefix() {
    Description description = new TestDescription("Testing");
    try {
      strings.assertStartsWith(description, "Yoda", "Luke");
    } catch (AssertionError e) {
      verify(failures).failure(description, shouldStartWith("Yoda", "Luke"));
      return;
View Full Code Here

    strings.assertNullOrEmpty(mock(Description.class), "");
  }

  @Test
  public void should_fail_if_actual_is_not_null_and_is_not_empty() {
    Description description = new TestDescription("Testing");
    try {
      strings.assertNullOrEmpty(description, "Yoda");
    } catch (AssertionError e) {
      assertEquals("[Testing] expecting:\n null or empty but was:<'Yoda'>", e.getMessage());
      verify(failures).failure(same(description), any(ErrorMessageFactory.class));
View Full Code Here

    strings.failures = failures;
  }

  @Test
  public void should_fail_if_both_Strings_are_not_equal_regardless_of_case() {
    Description description = new TestDescription("Testing");
    try {
      strings.assertEqualsIgnoringCase(description, actual, expected);
    } catch (AssertionError e) {
      String message = "[Testing] expecting:<" + quote(actual) + "> to be equal to:<" + quote(expected)
          + ">, ignoring case considerations";
View Full Code Here

    comparables.assertNotGreaterThan(mock(Description.class), 6, 6);
  }

  @Test
  public void should_fail_if_actual_is_greater_than_other() {
    Description description = new TestDescription("Testing");
    try {
      comparables.assertNotGreaterThan(description, 8, 6);
    } catch (AssertionError e) {
      assertEquals("[Testing] expecting:\n<8> should not be greater than:<6>", e.getMessage());
      verify(failures).failure(same(description), any(ErrorMessageFactory.class));
View Full Code Here

    files.assertIsDirectory(mock(Description.class), actual);
  }

  @Test
  public void should_fail_if_actual_is_not_directory() {
    Description description = new TestDescription("Testing");
    File actual = FakeFile.newWritableFile("/usr/local/actual.txt");
    try {
      files.assertIsDirectory(description, actual);
    } catch (AssertionError e) {
      assertEquals("[Testing] expecting path:</usr/local/actual.txt> to represent an existing directory",
View Full Code Here

TOP

Related Classes of org.fest.assertions.description.Description

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.