LookupName { public static String getFieldName(String lookupFieldName) { if (lookupFieldName.contains(".")) { return lookupFieldName.split("\\.")[0]; } return lookupFieldName; } private  LookupName(); static String lookupMethod(String lookupName); static String lookupCountMethod(String lookupNameOrMethodName); static String buildLookupFieldName(String fieldName, String relatedFieldName); static String getRelatedFieldName(String lookupFieldName); static String getFieldName(String lookupFieldName);  }
@Test public void shouldReturnFieldName() { assertEquals("fieldName", LookupName.getFieldName("fieldName.id")); assertEquals("collection", LookupName.getFieldName("collection.name")); assertEquals("field", LookupName.getFieldName("field")); }