Package org.hamcrest

Examples of org.hamcrest.Description.appendText()


      Description description = new StringDescription();
      description.appendText(reason);
      description.appendText("\nExpected: ");
      description.appendDescriptionOf(matcher);
      if (describeMismatchMethod != null) {
        description.appendText("\n     but: ");
        // matcher.describeMismatch(actual, description);
        ReflectionUtils.invokeMethod(describeMismatchMethod, matcher, actual, description);
      }
      else {
        description.appendText("\n     got: ");
View Full Code Here


        description.appendText("\n     but: ");
        // matcher.describeMismatch(actual, description);
        ReflectionUtils.invokeMethod(describeMismatchMethod, matcher, actual, description);
      }
      else {
        description.appendText("\n     got: ");
        description.appendValue(actual);
        description.appendText("\n");
      }
      throw new AssertionError(description.toString());
    }
View Full Code Here

        ReflectionUtils.invokeMethod(describeMismatchMethod, matcher, actual, description);
      }
      else {
        description.appendText("\n     got: ");
        description.appendValue(actual);
        description.appendText("\n");
      }
      throw new AssertionError(description.toString());
    }
  }
View Full Code Here

        }

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Description descriptionParameter = (Description) invocation.getArguments()[0];
            descriptionParameter.appendText(this.description);
            return Void.class;
        }
    }
}
View Full Code Here

        }

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Description descriptionParameter = (Description) invocation.getArguments()[0];
            descriptionParameter.appendText(this.description);
            return Void.class;
        }
    }
}
View Full Code Here

        }

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Description descriptionParameter = (Description) invocation.getArguments()[0];
            descriptionParameter.appendText(this.description);
            return Void.class;
        }
    }
}
View Full Code Here

        }

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Description descriptionParameter = (Description) invocation.getArguments()[0];
            descriptionParameter.appendText(this.description);
            return Void.class;
        }
    }
}
View Full Code Here

     * @throws AssertionError if the condition is not satisfied
     */
    public static void assertThat(Condition condition) {
        if(condition.isSatisfied()) return;
        Description description = new StringDescription();
        description.appendText("\nExpected: ")
                    .appendDescriptionOf(condition)
                    .appendText("\n     but: ");
        condition.describeDissatisfactionTo(description);
        throw new AssertionError(description.toString());
    }
View Full Code Here

  private final String msg;

  @Override
  public void is(Matcher<? super T> matching) {
    Description message = new StringDescription();
    message.appendText("expecting ");
    matching.describeTo(message);
    message.appendText(" but ");
    T obj = provider.get();
    if (!matching.matches(obj)) {
      matching.describeMismatch(obj, message);
View Full Code Here

  @Override
  public void is(Matcher<? super T> matching) {
    Description message = new StringDescription();
    message.appendText("expecting ");
    matching.describeTo(message);
    message.appendText(" but ");
    T obj = provider.get();
    if (!matching.matches(obj)) {
      matching.describeMismatch(obj, message);
      if (assertion) {
        throw new AssertionError((msg == null ? "" : msg + "\n")
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.