Package org.fest.assertions.description

Examples of org.fest.assertions.description.Description


   private String computeDescribitionText() {
      StringBuilder sb = new StringBuilder();
      sb.append(prefix.trim());

      Description d = super.description();
      if (d != null) {
         sb.append(" ").append(d.value());
      }
      return sb.toString();
   }
View Full Code Here


   protected AssertionError failWithMessage(String format, Object... arguments) {
      GwtWritableAssertionInfo info = new GwtWritableAssertionInfo();
      info.prefix(gwtInfo.prefix());
      info.overridingErrorMessage(gwtInfo.overridingErrorMessage());

      Description d = gwtInfo.superDescription();
      String newDescription = d != null ? d.value() : this.actual.getClass().getSimpleName();
      info.description(newDescription);

      return failures.failure(info, new BasicErrorMessageFactory(format, arguments));
   }
View Full Code Here

            Object expected) {
      GwtWritableAssertionInfo info = new GwtWritableAssertionInfo();
      info.prefix(gwtInfo.prefix());
      info.overridingErrorMessage(gwtInfo.overridingErrorMessage());

      Description d = gwtInfo.superDescription();
      String newDescription = d != null ? d.value() + " " + propertyName
               : this.actual.getClass().getSimpleName() + "'s " + propertyName;
      info.description(newDescription);

      return failures.failure(info, shouldBeEqual(actual, expected));
View Full Code Here

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

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

    matchers.assertHas(mock(Description.class), "Yoda", matcher);
  }

  @Test public void should_fail_if_Matcher_is_not_met() {
    matcher.shouldMatch(false);
    Description description = new TestDescription("Testing");
    try {
      matchers.assertHas(description, "Yoda", matcher);
    } catch (AssertionError e) {
      assertEquals("[Testing] expecting:<'Yoda'> to have:<TestMatcher>", e.getMessage());
      verify(failures).failure(same(description), any(ErrorMessageFactory.class));
View Full Code Here

    comparables.assertNotLessThan(mock(Description.class), "Yoda", "Yoda");
  }

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

    strings.assertDoesNotMatch(mock(Description.class), "Yoda", "*...");
  }

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

  @Test public void should_pass_if_objects_are_not_same() {
    objects.assertNotSame(mock(Description.class), "Yoda", "Luke");
  }

  @Test public void should_fail_if_objects_are_same() {
    Description description = new TestDescription("Testing");
    Object actual = new Person("Yoda");
    try {
      objects.assertNotSame(description, actual, actual);
    } catch (AssertionError e) {
      assertEquals("[Testing] expected not same:<Person[name='Yoda']>", e.getMessage());
View Full Code Here

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

  @Test
  public void should_fail_if_actual_does_not_exist() {
    Description description = new TestDescription("Testing");
    File actual = newNonExistingResource("/usr/local/actual.txt");
    try {
      files.assertExists(description, actual);
    } catch (AssertionError e) {
      assertEquals("[Testing] expecting resource in path:</usr/local/actual.txt> to exist", e.getMessage());
View Full Code Here

    objects.assertNull(mock(Description.class), null);
  }

  @Test
  public void should_fail_if_object_is_not_null() {
    Description description = new TestDescription("Testing");
    try {
      objects.assertNull(description, "Luke");
    } catch (AssertionError e) {
      String message = "[Testing] expected:<null> but was:<'Luke'>";
      assertEquals(message, e.getMessage());
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.