1 package net.sf.dozer.util.mapping.factory; 2 3 import junit.framework.TestCase; 4 import net.sf.dozer.util.mapping.MappingException; 5 6 9 public class JAXBBeanFactoryTest extends TestCase { 10 11 private JAXBBeanFactory factory; 12 protected void setUp() throws Exception { 13 super.setUp(); 14 factory = new JAXBBeanFactory(); 15 } 16 19 public void testCreateBeanForSimpleJaxbClass() { 20 21 Object obj = factory.createBean(null, null, "net.sf.dozer.util.mapping.vo.jaxb.employee.Employee"); 22 assertNotNull("Object can not be null",obj); 23 assertEquals("Invalid class build",obj.getClass().getName(),"net.sf.dozer.util.mapping.vo.jaxb.employee.impl.EmployeeImpl" ); 24 } 25 28 public void testCreateBeanClassNotFoundException() { 29 try { 30 factory.createBean(null, null, "ve.ve.DE"); 31 } catch (MappingException e) { 32 assertTrue(true); 33 } catch (Throwable e) { 35 fail("Not existing class should throw MappingException " + e.toString()); 36 } 37 38 } 39 42 public void testCreateBeanForInnerJaxbClass() { 43 44 Object obj = factory.createBean(null, null, "net.sf.dozer.util.mapping.vo.jaxb.employee.EmployeeWithInnerClassType$AddressType"); 45 assertNotNull("Object can not be null",obj); 46 assertEquals("Invalid class build",obj.getClass().getName(),"net.sf.dozer.util.mapping.vo.jaxb.employee.impl.EmployeeWithInnerClassTypeImpl$AddressTypeImpl" ); 47 } 48 49 } 50 | Popular Tags |