Search in sources :

Example 6 with XmlStream

use of com.yahoo.document.serialization.XmlStream in project vespa by vespa-engine.

the class PredicateFieldValueTest method requireThatXmlOutputIsPredicateLanguage.

@Test
public void requireThatXmlOutputIsPredicateLanguage() {
    Predicate predicate = new FeatureSet("key", "valueA", "valueB");
    XmlStream expected = new XmlStream();
    expected.beginTag("tag");
    expected.addContent(predicate.toString());
    expected.endTag();
    assertEquals(expected.toString(), printXml("tag", new PredicateFieldValue(predicate)));
}
Also used : XmlStream(com.yahoo.document.serialization.XmlStream) FeatureSet(com.yahoo.document.predicate.FeatureSet) Predicate(com.yahoo.document.predicate.Predicate) Test(org.junit.Test)

Example 7 with XmlStream

use of com.yahoo.document.serialization.XmlStream in project vespa by vespa-engine.

the class PredicateFieldValueTest method printXml.

private static String printXml(String tag, FieldValue value) {
    XmlStream out = new XmlStream();
    out.beginTag(tag);
    if (value != null) {
        value.printXml(out);
    }
    out.endTag();
    return out.toString();
}
Also used : XmlStream(com.yahoo.document.serialization.XmlStream)

Aggregations

XmlStream (com.yahoo.document.serialization.XmlStream)7 Test (org.junit.Test)2 FeatureSet (com.yahoo.document.predicate.FeatureSet)1 Predicate (com.yahoo.document.predicate.Predicate)1