@Test
    public void testNews10() throws Exception {
        VespaXMLFeedReader parser = new VespaXMLFeedReader("src/test/vespaxmlparser/test10.xml", manager);
        {
            FeedOperation op = parser.read();
            Document doc = op.getDocumentPut().getDocument();

            assertEquals(new StringFieldValue("testUrl"), doc.getFieldValue("url"));
            assertEquals(new StringFieldValue("testTitle"), doc.getFieldValue("title"));
            assertEquals(new IntegerFieldValue(1), doc.getFieldValue("last_downloaded"));
            assertEquals(new LongFieldValue(2), doc.getFieldValue("value_long"));

            Array strArr = (Array)doc.getFieldValue("stringarr");
            assertEquals(new StringFieldValue("stringarrItem1"), strArr.get(0));
            assertEquals(new StringFieldValue("stringarrItem2"), strArr.get(1));

            Array intArr = (Array)doc.getFieldValue("intarr");
            assertEquals(new IntegerFieldValue(3), intArr.get(0));
            assertEquals(new IntegerFieldValue(4), intArr.get(1));

            Array longArr = (Array)doc.getFieldValue("longarr");
            assertEquals(new LongFieldValue(5L), longArr.get(0));
            assertEquals(new LongFieldValue(6L), longArr.get(1));

            Array byteArr = (Array)doc.getFieldValue("bytearr");
            assertEquals(new ByteFieldValue((byte)7), byteArr.get(0));
            assertEquals(new ByteFieldValue((byte)8), byteArr.get(1));

            Array floatArr = (Array)doc.getFieldValue("floatarr");
            assertEquals(new FloatFieldValue(9.0f), floatArr.get(0));
            assertEquals(new FloatFieldValue(10.0f), floatArr.get(1));

            WeightedSet intWset = (WeightedSet)doc.getFieldValue("weightedsetint");
            assertEquals(Integer.valueOf(11), intWset.get(new IntegerFieldValue(11)));
            assertEquals(Integer.valueOf(12), intWset.get(new IntegerFieldValue(12)));

            WeightedSet strWset = (WeightedSet)doc.getFieldValue("weightedsetstring");
            assertEquals(Integer.valueOf(13), strWset.get(new StringFieldValue("string13")));
            assertEquals(Integer.valueOf(14), strWset.get(new StringFieldValue("string14")));
        }
        {
            FeedOperation op = parser.read();
            Document doc = op.getDocumentPut().getDocument();
            assertNotNull(doc);
            assertEquals(new StringFieldValue("testUrl2"), doc.getFieldValue("url"));
        }
        {
            FeedOperation op = parser.read();
            DocumentUpdate upd = op.getDocumentUpdate();

            assertNull(upd.getFieldUpdate("url"));
            assertNull(upd.getFieldUpdate("title"));
            assertNull(upd.getFieldUpdate("last_downloaded"));
            assertNull(upd.getFieldUpdate("value_long"));
            assertNull(upd.getFieldUpdate("value_content"));

            List<ValueUpdate> lst = upd.getFieldUpdate("stringarr").getValueUpdates();
            assertEquals(new StringFieldValue("addString1"), lst.get(0).getValue());
            assertEquals(new StringFieldValue("addString2"), lst.get(1).getValue());

            assertNull(upd.getFieldUpdate("intarr"));

            lst = upd.getFieldUpdate("longarr").getValueUpdates();
            assertEquals(new LongFieldValue((long)5), lst.get(0).getValue());

            assertNull(upd.getFieldUpdate("bytearr"));
            assertNull(upd.getFieldUpdate("floatarr"));

            assertEquals(new IntegerFieldValue(11), upd.getFieldUpdate("weightedsetint").getValueUpdate(0).getValue());
            assertEquals(Integer.valueOf(11),
                         (Integer)((AddValueUpdate)upd.getFieldUpdate("weightedsetint").getValueUpdate(0))
                                 .getWeight());
            assertEquals(new IntegerFieldValue(12), upd.getFieldUpdate("weightedsetint").getValueUpdate(1).getValue());
            assertEquals(Integer.valueOf(12),
                         (Integer)((AddValueUpdate)upd.getFieldUpdate("weightedsetint").getValueUpdate(1))
                                 .getWeight());

            assertEquals(new StringFieldValue("add13"), upd.getFieldUpdate("weightedsetstring").getValueUpdate(0).getValue());
            assertEquals(Integer.valueOf(1),
                         (Integer)((AddValueUpdate)upd.getFieldUpdate("weightedsetstring").getValueUpdate(0))
                                 .getWeight());
        }
        {
            FeedOperation op = parser.read();
            DocumentUpdate upd = op.getDocumentUpdate();

            assertEquals(new StringFieldValue("assignUrl"),
                         upd.getFieldUpdate("url").getValueUpdate(0).getValue());

            assertNull(upd.getFieldUpdate("title"));
            assertNull(upd.getFieldUpdate("last_downloaded"));
            assertEquals(new LongFieldValue(2),
                         upd.getFieldUpdate("value_long").getValueUpdate(0).getValue());
            assertNull(upd.getFieldUpdate("value_content"));

            Array strArr = (Array)upd.getFieldUpdate("stringarr").getValueUpdate(0).getValue();
            assertEquals(new StringFieldValue("assignString1"), strArr.get(0));
            assertEquals(new StringFieldValue("assignString2"), strArr.get(1));

            Array intArr = (Array)upd.getFieldUpdate("intarr").getValueUpdate(0).getValue();
            assertEquals(new IntegerFieldValue(3), intArr.get(0));
            assertEquals(new IntegerFieldValue(4), intArr.get(1));

            assertNull(upd.getFieldUpdate("longarr"));
            assertNull(upd.getFieldUpdate("bytearr"));
            assertNull(upd.getFieldUpdate("floatarr"));

            WeightedSet intWset = (WeightedSet)upd.getFieldUpdate("weightedsetint").getValueUpdate(0).getValue();
            assertEquals(Integer.valueOf(11), intWset.get(new IntegerFieldValue(11)));
            assertEquals(Integer.valueOf(12), intWset.get(new IntegerFieldValue(12)));

            assertNull(upd.getFieldUpdate("weightedsetstring"));
        }
        {
            FeedOperation op = parser.read();
            assertEquals("id:ns:news::http://news10e", op.getDocumentRemove().getId().toString());
        }
        {
            // Illegal remove without documentid attribute
            try {
                parser.read();
                fail();
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }
    }
Simple test case for Vespa XML parser.

@author sveina
document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java