01: package net.sourceforge.jaxor.parser.tests;
02:
03: import junit.framework.TestCase;
04: import net.sourceforge.jaxor.parser.*;
05: import net.sourceforge.jaxor.util.SystemException;
06:
07: import java.util.Properties;
08:
09: /*
10: * User: Mike
11: * Date: Aug 27, 2003
12: * Time: 9:54:44 PM
13: */
14:
15: public class JaxorTest extends TestCase {
16:
17: Jaxor j;
18: EntityCollection col;
19:
20: protected void setUp() throws Exception {
21: super .setUp();
22: j = new Jaxor();
23: j.setPackage("package.name");
24: Entity ent = new Entity();
25: ent.setName("Entity");
26: j.addEntity(ent);
27: col = new EntityCollection(new Generator(), new SourceMap(),
28: new Properties());
29: col.add(j);
30: }
31:
32: public void testFindingEntityWithFullName() {
33: assertEquals(col.resolveEntity("package.name.Entity"), j);
34: }
35:
36: public void testFindingEntityInEntityPackage() {
37: assertEquals(col.resolveEntity("Entity"), j);
38: }
39:
40: public void testFindingEntityWithJustEntityname() {
41: assertEquals(col.resolveEntity("Entity"), j);
42: }
43:
44: public void testMultipleIdenticalEntities() {
45: col.add(j);
46: try {
47: col.resolveEntity("Entity");
48: fail("Should faile to resolve");
49: } catch (SystemException expected) {
50:
51: }
52: }
53: }
|