LookupName { public static String getRelatedFieldName(String lookupFieldName) { if (lookupFieldName.contains(".")) { return lookupFieldName.split("\\.")[1]; } return null; } 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 shouldReturnRelatedName() { assertEquals("id", LookupName.getRelatedFieldName("fieldName.id")); assertEquals("name", LookupName.getRelatedFieldName("collection.name")); assertEquals(null, LookupName.getRelatedFieldName("field")); }