diff options
Diffstat (limited to 'document/src/test/java/com/yahoo/document/datatypes')
15 files changed, 50 insertions, 60 deletions
diff --git a/document/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java index cafaafd7326..7b1e161ef0e 100755 --- a/document/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/ArrayTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import com.yahoo.document.ArrayDataType; @@ -77,7 +77,7 @@ public class ArrayTestCase { @Test public void testWrappedList() { - Array<StringFieldValue> array = new Array<StringFieldValue>(DataType.getArray(DataType.STRING)); + Array<StringFieldValue> array = new Array<>(DataType.getArray(DataType.STRING)); List<String> list = new ArrayList<>(); list.add("foo"); list.add("bar"); @@ -217,10 +217,10 @@ public class ArrayTestCase { assertEquals(new StringFieldValue("apple"), subArray.get(1)); - assertEquals(false, array.containsAll(Arrays.<StringFieldValue>asList(new StringFieldValue("bob")))); - assertEquals(true, array.containsAll(Arrays.<StringFieldValue>asList(new StringFieldValue("foo"), new StringFieldValue("boo"), new StringFieldValue("apple")))); + assertEquals(false, array.containsAll(List.of(new StringFieldValue("bob")))); + assertEquals(true, array.containsAll(List.of(new StringFieldValue("foo"), new StringFieldValue("boo"), new StringFieldValue("apple")))); - array.removeAll(Arrays.<StringFieldValue>asList(new StringFieldValue("foo"), new StringFieldValue("boo"))); + array.removeAll(List.of(new StringFieldValue("foo"), new StringFieldValue("boo"))); assertEquals(1, array.size()); assertEquals(1, list.size()); @@ -249,7 +249,7 @@ public class ArrayTestCase { assertFalse(it.hasNext()); } - array.addAll(Arrays.<StringFieldValue>asList(new StringFieldValue("microsoft"), new StringFieldValue("google"))); + array.addAll(List.of(new StringFieldValue("microsoft"), new StringFieldValue("google"))); assertEquals(4, array.size()); assertEquals(4, list.size()); diff --git a/document/src/test/java/com/yahoo/document/datatypes/BoolFieldValueTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/BoolFieldValueTestCase.java index d4ebc00a443..e7972f4f594 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/BoolFieldValueTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/BoolFieldValueTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import org.junit.Test; diff --git a/document/src/test/java/com/yahoo/document/datatypes/MapTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/MapTestCase.java index 6f30569ef10..52bf349ef18 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/MapTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/MapTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import java.util.Map; diff --git a/document/src/test/java/com/yahoo/document/datatypes/NumericFieldValueTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/NumericFieldValueTestCase.java index b871b704dc3..e66dfa21222 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/NumericFieldValueTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/NumericFieldValueTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import org.junit.Test; diff --git a/document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java b/document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java index c77ad8493c9..34d74e7ae59 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java +++ b/document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import com.yahoo.document.DataType; diff --git a/document/src/test/java/com/yahoo/document/datatypes/RawTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/RawTestCase.java index bb91306cdb3..1efea2fa075 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/RawTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/RawTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import org.junit.Test; diff --git a/document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java index 9ff15339ab4..f16b1c27802 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import com.yahoo.document.DataType; diff --git a/document/src/test/java/com/yahoo/document/datatypes/StringFieldValueTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/StringFieldValueTestCase.java index 7a1b16c14ee..b248f0785b2 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/StringFieldValueTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/StringFieldValueTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import org.junit.Test; @@ -7,7 +7,7 @@ import static java.lang.Character.MAX_SURROGATE; import static java.lang.Character.MIN_SURROGATE; /** - * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a> + * @author Einar M R Rosenvinge * @since 5.1.14 */ public class StringFieldValueTestCase { @@ -17,81 +17,62 @@ public class StringFieldValueTestCase { new StringFieldValue("\t"); new StringFieldValue("\r"); new StringFieldValue("\n"); - for (int c = 0x20; c < 0xFDD0; c++) { - new StringFieldValue("" + Character.toChars(c)); - } for (int c = 0x20; c < MIN_SURROGATE; c++) { - new StringFieldValue("" + Character.toChars(c)[0]); + new StringFieldValue(new String(Character.toChars(c))); } - for (int c = MAX_SURROGATE; c < 0xFDD0; c++) { - new StringFieldValue("" + Character.toChars(c)[0]); + for (int c = MAX_SURROGATE + 1; c < 0xFDD0; c++) { + new StringFieldValue(new String(Character.toChars(c))); } - for (int c = 0xFDE0; c < 0xFFFF; c++) { - new StringFieldValue("" + Character.toChars(c)[0]); + for (int c = 0xFDE0; c < 0xFFFE; c++) { + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x10000; c < 0x1FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x20000; c < 0x2FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x30000; c < 0x3FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x40000; c < 0x4FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x50000; c < 0x5FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x60000; c < 0x6FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x70000; c < 0x7FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x80000; c < 0x8FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x90000; c < 0x9FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0xA0000; c < 0xAFFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0xB0000; c < 0xBFFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0xC0000; c < 0xCFFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0xD0000; c < 0xDFFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0xE0000; c < 0xEFFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0xF0000; c < 0xFFFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } for (int c = 0x100000; c < 0x10FFFE; c++) { - char[] chars = Character.toChars(c); - new StringFieldValue("" + chars[0] + chars[1]); + new StringFieldValue(new String(Character.toChars(c))); } } @@ -272,6 +253,14 @@ public class StringFieldValueTestCase { new StringFieldValue("\uFDDF"); } @Test(expected = IllegalArgumentException.class) + public void requireThatControlCharFailsFFFE() { + new StringFieldValue("\uFFFE"); + } + @Test(expected = IllegalArgumentException.class) + public void requireThatControlCharFailsFFFF() { + new StringFieldValue("\uFFFF"); + } + @Test(expected = IllegalArgumentException.class) public void requireThatControlCharFails1FFFE() { new StringFieldValue("\uD83F\uDFFE"); } diff --git a/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java index 9c38656a984..a51f477df0a 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/StringTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import com.yahoo.document.DataType; diff --git a/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java index 06875b8ca3c..26509dc33d4 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import com.yahoo.document.DataType; diff --git a/document/src/test/java/com/yahoo/document/datatypes/TensorFieldValueTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/TensorFieldValueTestCase.java index ad13ef9e95a..1ba0e9b98e6 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/TensorFieldValueTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/TensorFieldValueTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import com.yahoo.tensor.Tensor; diff --git a/document/src/test/java/com/yahoo/document/datatypes/UriFieldValueTest.java b/document/src/test/java/com/yahoo/document/datatypes/UriFieldValueTest.java index 173d69facc3..6aacb79f714 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/UriFieldValueTest.java +++ b/document/src/test/java/com/yahoo/document/datatypes/UriFieldValueTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import org.junit.Test; diff --git a/document/src/test/java/com/yahoo/document/datatypes/WeightedSetTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/WeightedSetTestCase.java index 5e0b16916a7..e2f97ed1484 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/WeightedSetTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/WeightedSetTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.datatypes; import com.yahoo.document.DataType; diff --git a/document/src/test/java/com/yahoo/document/datatypes/blog.sd b/document/src/test/java/com/yahoo/document/datatypes/blog.sd index bb077760894..28f7e755ddf 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/blog.sd +++ b/document/src/test/java/com/yahoo/document/datatypes/blog.sd @@ -1,4 +1,4 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. search blog { document blog { diff --git a/document/src/test/java/com/yahoo/document/datatypes/documentmanager.blog.sd b/document/src/test/java/com/yahoo/document/datatypes/documentmanager.blog.sd index 4f0cfd204ea..cc05657213c 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/documentmanager.blog.sd +++ b/document/src/test/java/com/yahoo/document/datatypes/documentmanager.blog.sd @@ -1,3 +1,4 @@ +# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. doctype[2] doctype[0].name "document" doctype[0].idx 10000 |