KeyNames { public static String cbForeignKeyName(String entityName, Long entityId, String fieldName, EntityType entityType) { return join("cb_fk", 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 shouldBuildComboboxForeignKeyNames() { assertEquals("cb_fk_TestEntity_comboBox_3", KeyNames.cbForeignKeyName("TestEntity", 3L, "comboBox", EntityType.STANDARD)); assertEquals("cb_fk_TestEntity__History_comboBox_3", KeyNames.cbForeignKeyName("TestEntity", 3L, "comboBox", EntityType.HISTORY)); assertEquals("cb_fk_TestEntity__Trash_comboBox_3", KeyNames.cbForeignKeyName("TestEntity", 3L, "comboBox", EntityType.TRASH)); }