import org.apache.cayenne.map.naming.BasicNamingStrategy;
import org.apache.cayenne.map.naming.ExportedKey;
public class BasicNamingStrategyTest extends TestCase {
public void testStrategy() throws Exception {
BasicNamingStrategy strategy = new BasicNamingStrategy();
ExportedKey key = new ExportedKey("ARTIST", "ARTIST_ID", null,
"PAINTING", "ARTIST_ID", null);
assertEquals(strategy.createDbRelationshipName(key, false), "toArtist");
assertEquals(strategy.createDbRelationshipName(key, true), "paintingArray");
key = new ExportedKey("PERSON", "PERSON_ID", null,
"PERSON", "MOTHER_ID", null);
assertEquals(strategy.createDbRelationshipName(key, false), "toPerson");
assertEquals(strategy.createDbRelationshipName(key, true), "personArray");
assertEquals(strategy.createObjEntityName(new DbEntity("ARTIST")), "Artist");
assertEquals(strategy.createObjEntityName(new DbEntity("ARTIST_WORK")), "ArtistWork");
assertEquals(strategy.createObjAttributeName(new DbAttribute("NAME")), "name");
assertEquals(strategy.createObjAttributeName(new DbAttribute("ARTIST_NAME")), "artistName");
assertEquals(strategy.createObjRelationshipName(new DbRelationship("toArtist")), "toArtist");
assertEquals(strategy.createObjRelationshipName(new DbRelationship("paintingArray")), "paintingArray");
}