DynamicPointerFactoryEx extends DynamicPointerFactory { @Override public NodePointer createNodePointer( QName name, Object bean, Locale locale) { JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass()); if (bi.isDynamic()) { DynamicPropertyHandler handler = ValueUtils.getDynamicPropertyHandler( bi.getDynamicPropertyHandlerClass()); return new DynamicPointerEx(name, bean, handler, locale); } return null; } DynamicPointerFactoryEx(); @Override int getOrder(); @Override NodePointer createNodePointer(
        QName name, Object bean, Locale locale); @Override NodePointer createNodePointer(
        NodePointer parent, QName name, Object bean); static final int DYNAMIC_POINTER_FACTORY_EX_ORDER; }
@Test public void testCreateNodePointerQname01() throws Exception { DynamicPointerFactoryEx factory = new DynamicPointerFactoryEx(); QName qName = new QName("name"); Object bean = new HashMap<Object, Object>(); Locale locale = new Locale("ja"); NodePointer result = factory.createNodePointer(qName, bean, locale); assertSame(DynamicPointerEx.class, result.getClass()); assertSame(locale, result.getLocale()); assertSame(qName, result.getName()); assertSame(bean, ReflectionTestUtils.getField(result, "bean")); }
@Test public void testCreateNodePointerQname02() throws Exception { DynamicPointerFactoryEx factory = new DynamicPointerFactoryEx(); QName qName = new QName("name"); Object bean = new Object(); Locale locale = new Locale("ja"); assertNull(factory.createNodePointer(qName, bean, locale)); }
@Test public void testCreateNodePointerNodePointer01() throws Exception { DynamicPointerFactoryEx factory = new DynamicPointerFactoryEx(); QName qName = new QName("name"); Locale locale = new Locale("ja"); NodePointer nodePointer = NodePointer.newNodePointer(qName, null, locale); NodePointer result = factory.createNodePointer(nodePointer, qName, null); assertSame(NullPointer.class, result.getClass()); assertSame(qName, result.getName()); assertSame(nodePointer, result.getParent()); }
@Test public void testCreateNodePointerNodePointer02() throws Exception { DynamicPointerFactoryEx factory = new DynamicPointerFactoryEx(); QName qName = new QName("name"); Object bean = new HashMap<Object, Object>(); Locale locale = new Locale("ja"); NodePointer nodePointer = NodePointer.newNodePointer(qName, bean, locale); NodePointer result = factory.createNodePointer(nodePointer, qName, bean); assertSame(DynamicPointerEx.class, result.getClass()); assertSame(nodePointer, result.getParent()); assertSame(qName, result.getName()); assertSame(bean, ReflectionTestUtils.getField(result, "bean")); }
@Test public void testCreateNodePointerNodePointer03() throws Exception { DynamicPointerFactoryEx factory = new DynamicPointerFactoryEx(); QName qName = new QName("name"); Object bean = new Object(); Locale locale = new Locale("ja"); NodePointer nodePointer = NodePointer.newNodePointer(qName, bean, locale); assertNull(factory.createNodePointer(nodePointer, qName, bean)); }