### Question:
PredefinedFields { public static boolean isFieldAnArrayCount(String fieldName, Fields metadataFields){ if(!doesFieldNameMatchArrayCountPattern(fieldName)){ return false; } Field field = metadataFields.getField(createArrayFieldNameFromCountField(fieldName)); if((field != null) && (field instanceof ArrayField)){ return true; } return false; } private  PredefinedFields(); static void ensurePredefinedFields(EntityMetadata md); static void updateArraySizes(EntityMetadata md, JsonNodeFactory factory, JsonDoc doc); static boolean isFieldObjectType(String fieldName); static boolean isFieldAnArrayCount(String fieldName, Fields metadataFields); static boolean isPredefinedField(String fieldName, Fields fields); static String createArrayFieldNameFromCountField(String countField); static String createArrayCountFieldName(String arrayFieldName); static final String OBJECTTYPE_FIELD; static final String FIELD_ARRAY_COUNT_POSTFIX; static final Path OBJECTTYPE_PATH; }### Answer:
@Test public void testIsFieldAnArrayCount_DoesNotMatchArrayCountPattern(){ assertFalse(PredefinedFields.isFieldAnArrayCount("someField", null)); }
@Test public void testIsFieldAnArrayCount_DoesNotHaveMatchingArrayField(){ assertFalse(PredefinedFields.isFieldAnArrayCount("someField" + PredefinedFields.FIELD_ARRAY_COUNT_POSTFIX, new Fields(null))); }
@Test public void testIsFieldAnArrayCount_True(){ String arrayFieldName = "arrayField"; Fields fields = new Fields(null); fields.addNew(new ArrayField(arrayFieldName)); assertTrue(PredefinedFields.isFieldAnArrayCount(arrayFieldName + PredefinedFields.FIELD_ARRAY_COUNT_POSTFIX, fields)); }
@Test public void testIsFieldAnArrayCount_Exists_ButNotArrayField(){ String arrayFieldName = "arrayField"; Fields fields = new Fields(null); fields.addNew(new SimpleField(arrayFieldName)); assertFalse(PredefinedFields.isFieldAnArrayCount(arrayFieldName + PredefinedFields.FIELD_ARRAY_COUNT_POSTFIX, fields)); }