blob: 8f0ef3173723cdc7464879fa494dd5fedb4655d9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.serialization;
import com.yahoo.document.DataType;
import com.yahoo.document.Document;
import com.yahoo.document.DocumentType;
import com.yahoo.document.Field;
import com.yahoo.document.datatypes.PredicateFieldValue;
import org.junit.Test;
import org.mockito.Mockito;
/**
* @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
*/
public class XmlDocumentWriterTestCase {
@Test
public void requireThatPredicateFieldValuesAreSerializedAsString() {
DocumentType docType = new DocumentType("my_type");
Field field = new Field("my_predicate", DataType.PREDICATE);
docType.addField(field);
Document doc = new Document(docType, "doc:scheme:");
PredicateFieldValue predicate = Mockito.mock(PredicateFieldValue.class);
doc.setFieldValue("my_predicate", predicate);
new XmlDocumentWriter().write(doc);
Mockito.verify(predicate, Mockito.times(1)).printXml(Mockito.any(XmlStream.class));
}
}
|