class ShouldBeEqualWithTimePrecision extends BasicErrorMessageFactory {

  /**
   * Creates a new <code>{@link org.assertj.core.error.ShouldBeEqualWithTimePrecision}</code>.
   *
   * @param actual    the actual value in the failed assertion.
   * @param expected  the expected value in the failed assertion.
   * @param precision the {@link TimeUnit} used to compare actual with expected.
   * @return the created {@code AssertionErrorFactory}.
   */
  public static ErrorMessageFactory shouldBeEqual(Date actual, Date expected, TimeUnit precision) {
    return new ShouldBeEqualWithTimePrecision(actual, expected, precision);
  }

  private ShouldBeEqualWithTimePrecision(Date actual, Date expected, TimeUnit precision) {
    super(buildErrorMessageTemplate(precision), actual, expected);
  }

  private static String buildErrorMessageTemplate(final TimeUnit precision) {<FILL_FUNCTION_BODY>}

}

    String fields = "";
    String lastField = "";
    if (precision.equals(TimeUnit.HOURS)) {
      lastField = "day";
    } else if (precision.equals(TimeUnit.MINUTES)) {
      fields = ", day";
      lastField = "hour";
    } else if (precision.equals(TimeUnit.SECONDS)) {
      fields = ", day, hour";
      lastField = "minute";
    } else if (precision.equals(TimeUnit.MILLISECONDS)) {
      fields = ", day, hour, minute";
      lastField = "second";
    }
    return "%nExpecting actual:%n" +
           "  %s%n" +
           "to have same year, month" + fields + " and " + lastField + " as:%n" +
           "  %s%n" +
           "but had not.";
  
<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