code: public static Matcher<JsonElement> maxProperties(final int maxProperties) {
          return new TypeSafeDiagnosingMatcher<JsonElement>() {
              @Override
              protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
                  //we do not care for the properties if parent item is not JsonObject
                  if (!item.isJsonObject()) return true;
  
  
                  if (item.asJsonObject().length() > maxProperties) {
                      mismatchDescription.appendText("properties in Json object more than defined");
                      return false;
                  }
  
                  return true;
              }
  
              @Override
              public void describeTo(Description description) {
                  description.appendText("object properties max count");
              }
          };
      }
docs: ==> OBJECT ==>