class ShouldHaveCause extends BasicErrorMessageFactory {

  public static ErrorMessageFactory shouldHaveCause(Throwable actual, Throwable expectedCause) {<FILL_FUNCTION_BODY>}

  public static ErrorMessageFactory shouldHaveCause(Throwable actualCause) {
    return new BasicErrorMessageFactory("Expecting actual throwable to have a cause but it did not, actual was:%n%s",
                                        actualCause);
  }

  private ShouldHaveCause(Throwable actual, Throwable expectedCause) {
    super("%n" +
          "Expecting a cause with type:%n" +
          "  %s%n" +
          "and message:%n" +
          "  %s%n" +
          "but type was:%n" +
          "  %s%n" +
          "and message was:%n" +
          "  %s.%n%n" +
          "Throwable that failed the check:%n" +
          escapePercent(getStackTrace(actual)),
          expectedCause.getClass().getName(), expectedCause.getMessage(),
          actual.getCause().getClass().getName(), actual.getCause().getMessage());
  }

  private ShouldHaveCause(Throwable expectedCause) {
    super("%n" +
          "Expecting a cause with type:%n" +
          "  %s%n" +
          "and message:%n" +
          "  %s%n" +
          "but actualCause had no cause.",
          expectedCause.getClass().getName(), expectedCause.getMessage());
  }

  private ShouldHaveCause(Throwable actual, Class<? extends Throwable> expectedCauseClass) {
    super("%n" +
          "Expecting a cause with type:%n" +
          "  %s%n" +
          "but type was:%n" +
          "  %s.%n%n" +
          "Throwable that failed the check:%n" +
          escapePercent(getStackTrace(actual)),
          expectedCauseClass.getName(), actual.getCause().getClass().getName());
  }

  private ShouldHaveCause(Throwable actual, String expectedCauseMessage) {
    super("%n" +
          "Expecting a cause with message:%n" +
          "  %s%n" +
          "but message was:%n" +
          "  %s.%n%n" +
          "Throwable that failed the check:%n" +
          escapePercent(getStackTrace(actual)),
          expectedCauseMessage, actual.getCause().getMessage());
  }
}

    checkArgument(expectedCause != null, "expected cause should not be null");
    // actual has no cause
    if (actual.getCause() == null) return new ShouldHaveCause(expectedCause);
    // same message => different type
    if (Objects.equals(actual.getCause().getMessage(), expectedCause.getMessage()))
      return new ShouldHaveCause(actual, expectedCause.getClass());
    // same type => different message
    if (Objects.equals(actual.getCause().getClass(), expectedCause.getClass()))
      return new ShouldHaveCause(actual, expectedCause.getMessage());
    return new ShouldHaveCause(actual, expectedCause);
  
<methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>protected final non-sealed java.lang.Object[] arguments,protected final non-sealed java.lang.String format,org.assertj.core.error.MessageFormatter formatter