blob: faf444180914219214027e6b7136f7db71c27392 (
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
30
31
32
33
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;
import com.yahoo.document.datatypes.IntegerFieldValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/**
* @author Simon Thoresen Hult
*/
public class SimpleDocumentTestCase {
@Test
public void requireThatAccessorsWorks() {
DocumentType type = new DocumentType("test");
type.addField("int", DataType.INT);
Document doc = new Document(type, "id:ns:test::");
SimpleDocument simple = new SimpleDocument(doc);
assertNull(simple.get("int"));
assertNull(doc.getFieldValue("int"));
simple.set("int", 69);
assertEquals(69, simple.get("int"));
assertEquals(new IntegerFieldValue(69), doc.getFieldValue("int"));
simple.remove("int");
assertNull(simple.get("int"));
assertNull(doc.getFieldValue("int"));
}
}
|