Examples of BasicErrorMessageFactory


Examples of org.fest.assertions.error.BasicErrorMessageFactory

   * @throws AssertionError if the given objects refer to the same instance.
   */
  public void assertNotSame(Description description, Object actual, Object other) {
    if (actual == other) {
      String format = "expected not same:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual));
    }
  }
View Full Code Here

Examples of org.fest.assertions.error.BasicErrorMessageFactory

  public void assertIsInstanceOf(Description description, Object actual, Class<?> type) {
    checkNotNull(type);
    assertNotNull(description, actual);
    if (!type.isInstance(actual)) {
      String format = "expecting <%s> to be an instance of:<%s> but was instance of:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, type, actual.getClass()));
    }
  }
View Full Code Here

Examples of org.fest.assertions.error.BasicErrorMessageFactory

   */
  public void assertIsNotInstanceOf(Description description, Object actual, Class<?> type) {
    checkNotNull(type);
    if (type.isInstance(actual)) {
      String format = "expecting <%s> not to be an instance of:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, type));
    }
  }
View Full Code Here

Examples of org.fest.assertions.error.BasicErrorMessageFactory

  public void assertIsInstanceOfAny(Description description, Object actual, Class<?>[] types) {
    checkNotNullOrEmpty(types);
    assertNotNull(description, actual);
    if (!isInstanceOfAny(actual, types)) {
      String format = "expecting <%s> to be an instance of any of:<%s> but was instance of:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, types, actual.getClass()));
    }
  }
View Full Code Here

Examples of org.fest.assertions.error.BasicErrorMessageFactory

   */
  public void assertIsNotInstanceOfAny(Description description, Object actual, Class<?>[] types) {
    checkNotNullOrEmpty(types);
    if (isInstanceOfAny(actual, types)) {
      String format = "expecting <%s> not to be an instance of any of:<%s>";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual, types));
    }
  }
View Full Code Here

Examples of org.fest.assertions.error.BasicErrorMessageFactory

   */
  public void assertExists(Description description, File actual) {
    assertNotNull(description, actual);
    if (!actual.exists()) {
      String format = "expecting resource in path:<%s> to exist";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual));
    }
  }
View Full Code Here

Examples of org.fest.assertions.error.BasicErrorMessageFactory

   */
  public void assertDoesNotExist(Description description, File actual) {
    assertNotNull(description, actual);
    if (actual.exists()) {
      String format = "expecting resource in path:<%s> not to exist";
      throw failures.failure(description, new BasicErrorMessageFactory(format, actual));
    }
  }
View Full Code Here

Examples of org.fest.assertions.error.BasicErrorMessageFactory

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

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

Examples of org.fest.assertions.error.BasicErrorMessageFactory

      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
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.