summaryrefslogtreecommitdiffstats
path: root/documentgen-test
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-06-28 16:00:13 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2019-06-28 16:00:13 +0200
commitb44dcbc8c933969b6b012422764019f68fbe5f44 (patch)
treeafddaa5df8f1449382f01424dfe3d00b5bfea6d4 /documentgen-test
parenta828f842e8cff9330228a125e6af0805a01e0a07 (diff)
Add support for upgrades of values in maps.
Since keys in maps and weighted sets must be primitives we should be complete here.
Diffstat (limited to 'documentgen-test')
-rw-r--r--documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java b/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
index b3aca93cd96..8c20355ce0c 100644
--- a/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
+++ b/documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java
@@ -316,9 +316,7 @@ public class DocumentGenPluginTest {
verifyArrayOfStruct(toBook(copyBySerialization(book)));
}
- @Test
- public void testMaps() {
- Book book = getBook();
+ private void verifyMaps(Book book) {
assertTrue(book.getField("stringmap").getDataType() instanceof MapDataType);
MapFieldValue mfv = (MapFieldValue) book.getFieldValue("stringmap");
assertEquals(mfv.get(new StringFieldValue("Melville")), new StringFieldValue("Moby Dick"));
@@ -328,6 +326,8 @@ public class DocumentGenPluginTest {
assertEquals(mfv.keySet().size(), 2);
book.getStringmap().put("Melville", "MD");
assertEquals(mfv.keySet().size(), 3);
+ book.getStringmap().put("Melville", "Moby Dick");
+ assertEquals(mfv.keySet().size(), 3);
assertEquals(book.getStructmap().get(50).getS1(), "test s1");
MapFieldValue mfv2 = (MapFieldValue) book.getFieldValue("structmap");
@@ -337,6 +337,13 @@ public class DocumentGenPluginTest {
}
@Test
+ public void testMaps() {
+ Book book = getBook();
+ verifyMaps(book);
+ verifyMaps(toBook(copyBySerialization(book)));
+ }
+
+ @Test
public void testWeightedSets() {
Book book = getBook();
assertTrue(book.getField("mywsfloat").getDataType() instanceof WeightedSetDataType);