DynamicPropertyPointerEx extends DynamicPropertyPointer { @Override public int getLength() { Object value = getBaseValue(); if (value == null) { return 1; } return ValueUtils.getLength(value); } DynamicPropertyPointerEx(NodePointer parent,
            DynamicPropertyHandler handler); @Override int getLength();  }
@Test @SuppressWarnings("unchecked") public void testGetLength01() throws Exception { QName qName = new QName("name"); @SuppressWarnings("rawtypes") Map map = new HashMap(); map.put("key", null); DynamicPropertyHandler handler = new MapDynamicPropertyHandler(); Locale locale = new Locale("ja"); NodePointer nodePointer = NodePointer.newNodePointer(qName, map, locale); DynamicPropertyPointerEx pointer = new DynamicPropertyPointerEx(nodePointer, handler); pointer.setPropertyName("key"); assertEquals(1, pointer.getLength()); }
@Test @SuppressWarnings("unchecked") public void testGetLength02() throws Exception { QName qName = new QName("name"); @SuppressWarnings("rawtypes") Map map = new HashMap(); map.put("key", new String[]{"a", "b", "c"}); DynamicPropertyHandler handler = new MapDynamicPropertyHandler(); Locale locale = new Locale("ja"); NodePointer nodePointer = NodePointer.newNodePointer(qName, map, locale); DynamicPropertyPointerEx pointer = new DynamicPropertyPointerEx(nodePointer, handler); pointer.setPropertyName("key"); assertEquals(3, pointer.getLength()); }