BeanPropertyPointerEx extends BeanPropertyPointer { @Override public boolean isCollection() { if (getBaseValue() == null) { return false; } return super.isCollection(); } BeanPropertyPointerEx(NodePointer parent, JXPathBeanInfo beanInfo); @Override int getLength(); @Override boolean isCollection();  }
@Test public void testIsCollection01() throws Exception { QName qName = new QName("property"); BeanPropertyPointerEx_JavaBeanStub01 bean = new BeanPropertyPointerEx_JavaBeanStub01(); Locale locale = new Locale("ja"); NodePointer nodePointer = NodePointer.newNodePointer(qName, bean, locale); JXPathBasicBeanInfo beanInfo = new JXPathBasicBeanInfo(bean.getClass()); BeanPropertyPointerEx pointer = new BeanPropertyPointerEx(nodePointer, beanInfo); pointer.setPropertyName("property"); assertFalse(pointer.isCollection()); }
@Test public void testIsCollection02() throws Exception { QName qName = new QName("property"); BeanPropertyPointerEx_JavaBeanStub01 bean = new BeanPropertyPointerEx_JavaBeanStub01(); Locale locale = new Locale("ja"); NodePointer nodePointer = NodePointer.newNodePointer(qName, bean, locale); JXPathBasicBeanInfo beanInfo = new JXPathBasicBeanInfo(bean.getClass()); BeanPropertyPointerEx pointer = new BeanPropertyPointerEx(nodePointer, beanInfo); pointer.setPropertyName("listProperty"); assertTrue(pointer.isCollection()); }