diff options
author | jonmv <venstad@gmail.com> | 2024-01-23 09:42:37 +0100 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2024-01-23 09:42:37 +0100 |
commit | 8ead2603e1b5233736aadbc6ef7df26507b873df (patch) | |
tree | c56d42a43baf91b45ba8fffc53fd416f58f720b2 /document | |
parent | eddc0fc80444d693dc968ac5084254efc9f6a853 (diff) |
Document more shortcomings with unit tests
Diffstat (limited to 'document')
-rw-r--r-- | document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java b/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java index 7728f6cf816..839ce59fdd3 100644 --- a/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java +++ b/document/src/test/java/com/yahoo/document/json/JsonReaderTestCase.java @@ -154,6 +154,13 @@ public class JsonReaderTestCase { types.registerDocumentType(x); } { + DocumentType x = new DocumentType("testArrayOfArrayOfInt"); + DataType inner = new ArrayDataType(DataType.INT); + DataType outer = new ArrayDataType(inner); + x.addField(new Field("arrayOfArrayOfInt", outer)); + types.registerDocumentType(x); + } + { DocumentType x = new DocumentType("testsinglepos"); DataType d = PositionDataType.INSTANCE; x.addField(new Field("singlepos", d)); @@ -763,6 +770,28 @@ public class JsonReaderTestCase { } @Test + public void testNestedArrayMatch() { + // Supposed to work? + assertThrows(ClassCastException.class, + () -> parseUpdate(""" + { + "update": "id:unittest:testArrayOfArrayOfInt::whee", + "fields": { + "arrayOfArrayOfInt": { + "match": { + "element": 1, + "match": { + "element": 2, + "assign": 3 + } + } + } + } + } + """)); + } + + @Test public void testMatchCannotUpdateNestedFields() { // Should this work? It doesn't. assertThrows(ClassCastException.class, @@ -785,7 +814,7 @@ public class JsonReaderTestCase { } @Test - public void testMatchCannotAssignToMap() { + public void testMatchCannotAssignToNestedMap() { // Unsupported value type for map value assign. assertEquals("Field type Map<string,Array<int>> not supported.", assertThrows(UnsupportedOperationException.class, @@ -804,6 +833,27 @@ public class JsonReaderTestCase { """)).getMessage()); } + @Test + public void testMatchCannotAssignToMap() { + // Unsupported value type for map value assign. + assertEquals("Field type Map<string,string> not supported.", + assertThrows(UnsupportedOperationException.class, + () -> parseUpdate(""" + { + "update": "id:unittest:testmap::whee", + "fields": { + "actualmap": { + "match": { + "element": "bamse", + "assign": "bar" + } + } + } + } + """)).getMessage()); + } + + @Test public void testAssignInsideArrayInMap() throws IOException { |