Package org.fest.assertions.error

Examples of org.fest.assertions.error.BasicErrorMessageFactory


   */
  public void assertIsDirectory(Description description, File actual) {
    assertNotNull(description, actual);
    if (!actual.isDirectory()) {
      String format = "expecting path:<%s> to represent an existing directory";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual));
    }
  }
View Full Code Here


      String lineSeparator = System.getProperty("line.separator");
      FileDiffs diffs = comparator.compareContents(actual, expected, charset);
      if (!diffs.isEmpty()) {
        String format = "files expected:<%s> and actual:<%s> do not have equal content:" + lineSeparator + "%s"
            + lineSeparator + "using charset:<%s>";
        throw failures.failure(description, new BasicErrorMessageFactory(format, expected, actual, diffs, charset));
      }
    } catch (IOException e) {
      String format = "Failed to compare contents of files:<%s> and:<%s> using charset:<%s>";
      throw new IORuntimeException(String.format(format, actual, expected, charset), e);
    }
View Full Code Here

  }

  void assertHasSize(Description description, Object array, int expectedSize) {
    assertNotNull(description, array);
    if (expectedSize < 0) {
      throw failures.failure(description, new BasicErrorMessageFactory("The expectedSize should not be negative"));
    }
    int sizeOfActual = sizeOf(array);
    if (sizeOfActual != expectedSize) {
      throw failures.failure(description, shouldHaveSize(array, sizeOfActual, expectedSize));
    }
View Full Code Here

    boolean firstFound = false;
    int index = 0;

    if (sizeOfActual < sizeOfSequence) {
      String format = "The size of sequence is greater than the size of array";
      throw failures.failure(description, new BasicErrorMessageFactory(format, array, sequence));
    }
    for (int i = 0; i < sizeOfActual && index < sizeOfSequence; i++) {
      if (areEqual(Array.get(array, i), Array.get(sequence, index))) {
        firstFound = true;
        index++;
View Full Code Here

   */
  public <T> void assertIs(Description description, T actual, Matcher<? super T> matcher) {
    checkNotNull(matcher);
    if (!matcher.matches(actual)) {
      String format = "expecting:<%s> to be:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, matcher));
    }
  }
View Full Code Here

   */
  public <T> void assertIsNot(Description description, T actual, Matcher<? super T> matcher) {
    checkNotNull(matcher);
    if (matcher.matches(actual)) {
      String format = "expecting:<%s> not to be:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, matcher));
    }
  }
View Full Code Here

   */
  public <T> void assertHas(Description description, T actual, Matcher<? super T> matcher) {
    checkNotNull(matcher);
    if (!matcher.matches(actual)) {
      String format = "expecting:<%s> to have:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, matcher));
    }
  }
View Full Code Here

   * @throws AssertionError if the <em>actual</em> value satisfies the given {@code Matcher}.
   */
  public <T> void assertDoesNotHave(Description description, T actual, Matcher<? super T> matcher) {
    if (matcher.matches(actual)) {
      String format = "expecting:<%s> not to have:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, matcher));
    }
  }
View Full Code Here

   */
  public void assertEqualsIgnoringCase(@Nullable Description description, @Nullable String actual,
      @Nullable String expected) {
    if (!areEqualIgnoringCase(actual, expected)) {
      String format = "expecting:<%s> to be equal to:<%s>, ignoring case considerations";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, expected));
    }
  }
View Full Code Here

  public void assertContains(@Nullable Description description, @Nullable String actual, @Nonnull String sequence) {
    checkNotNull(sequence);
    assertNotNull(description, actual);
    if (!actual.contains(sequence)) {
      String format = "expecting:<%s> to contain:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, sequence));
    }
  }
View Full Code Here

TOP

Related Classes of org.fest.assertions.error.BasicErrorMessageFactory

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.