class ShouldOnlyHaveFields extends BasicErrorMessageFactory {

  /**
   * Creates a new <code>{@link ShouldOnlyHaveFields}</code>.
   *
   * @param actual the actual value in the failed assertion.
   * @param expected expected fields for this class
   * @param notFound fields in {@code expected} not found in the {@code actual}.
   * @param notExpected fields in the {@code actual} that were not in {@code expected}.
   * @return the created {@code ErrorMessageFactory}.
   */
  public static ErrorMessageFactory shouldOnlyHaveFields(Class<?> actual, Collection<String> expected,
                                                         Collection<String> notFound,
                                                         Collection<String> notExpected) {
    return create(actual, expected, notFound, notExpected, false);
  }

  /**
   * Creates a new <code>{@link ShouldOnlyHaveFields}</code>.
   *
   * @param actual the actual value in the failed assertion.
   * @param expected expected fields for this class
   * @param notFound fields in {@code expected} not found in the {@code actual}.
   * @param notExpected fields in the {@code actual} that were not in {@code expected}.
   * @return the created {@code ErrorMessageFactory}.
   */
  public static ErrorMessageFactory shouldOnlyHaveDeclaredFields(Class<?> actual, Collection<String> expected,
                                                                 Collection<String> notFound,
                                                                 Collection<String> notExpected) {
    return create(actual, expected, notFound, notExpected, true);
  }

  private static ErrorMessageFactory create(Class<?> actual, Collection<String> expected, Collection<String> notFound,
                                            Collection<String> notExpected, boolean declared) {<FILL_FUNCTION_BODY>}

  private ShouldOnlyHaveFields(Class<?> actual, Collection<String> expected, Collection<String> notFound,
                               Collection<String> notExpected,
                               boolean declared) {
    super("%n" +
          "Expecting%n" +
          "  %s%n" +
          "to only have the following " + (declared ? "declared" : "public accessible") + " fields:%n" +
          "  %s%n" +
          "fields not found:%n" +
          "  %s%n" +
          "and fields not expected:%n" +
          "  %s", actual, expected, notFound, notExpected);
  }

  private ShouldOnlyHaveFields(Class<?> actual, Collection<String> expected,
                               Collection<String> notFoundOrNotExpected,
                               ErrorType errorType, boolean declared) {
    super("%n" +
          "Expecting%n" +
          "  %s%n" +
          "to only have the following " + (declared ? "declared" : "public accessible") + " fields:%n" +
          "  %s%n" +
          (errorType == NOT_FOUND_ONLY ? "but could not find the following fields:%n"
              : "but the following fields were unexpected:%n")
          +
          "  %s",
          actual, expected, notFoundOrNotExpected);
  }

  enum ErrorType {
    NOT_FOUND_ONLY, NOT_EXPECTED_ONLY
  }
}

    if (isNullOrEmpty(notExpected)) {
      return new ShouldOnlyHaveFields(actual, expected, notFound, NOT_FOUND_ONLY, declared);
    }

    if (isNullOrEmpty(notFound)) {
      return new ShouldOnlyHaveFields(actual, expected, notExpected, NOT_EXPECTED_ONLY, declared);
    }

    return new ShouldOnlyHaveFields(actual, expected, notFound, notExpected, declared);
  
<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