KeyNames { public static String lookupIndexKeyName(String entityName, Long entityId, String fieldName, EntityType entityType) { return join("lkp_idx", entityType.getName(entityName), fieldName, entityId); } private  KeyNames(); static String lookupIndexKeyName(String entityName, Long entityId, String fieldName, EntityType entityType); static String foreignKeyName(String entityName, Long entityId, String fieldName, EntityType entityType); static String mapForeignKeyName(String entityName, Long entityId, String fieldName, EntityType entityType); static String cbForeignKeyName(String entityName, Long entityId, String fieldName, EntityType entityType); static String uniqueKeyName(String entityName, String fieldName);  }
@Test public void shouldBuildLookupIndexNames() { assertEquals("lkp_idx_TestEntity_testField_3", KeyNames.lookupIndexKeyName("TestEntity", 3L, "testField", EntityType.STANDARD)); assertEquals("lkp_idx_TestEntity__History_testField_3", KeyNames.lookupIndexKeyName("TestEntity", 3L, "testField", EntityType.HISTORY)); assertEquals("lkp_idx_TestEntity__Trash_testField_3", KeyNames.lookupIndexKeyName("TestEntity", 3L, "testField", EntityType.TRASH)); }