diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-03-05 11:12:48 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-03-05 11:39:00 +0000 |
commit | 76858e7407600b448696e7ddf101ee6431cec2ee (patch) | |
tree | f63e2f6c38ebe994758fb8a38758823cd9cb9673 /config-model/src/test/java/com | |
parent | 546d0305d5b4973ded811bf767d7c3d256b467d8 (diff) |
test new and old code path
Diffstat (limited to 'config-model/src/test/java/com')
-rwxr-xr-x | config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java index c27dd9dfdfb..2ce88e2148d 100755 --- a/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchdefinition; +import com.yahoo.config.model.deploy.TestProperties; import com.yahoo.document.config.DocumenttypesConfig; import com.yahoo.document.config.DocumentmanagerConfig; import com.yahoo.searchdefinition.derived.Deriver; @@ -27,7 +28,8 @@ public class StructTestCase extends AbstractSchemaTestCase { try { ApplicationBuilder.buildFromFile("src/test/examples/badstruct.sd"); fail("Should throw exception."); - } catch (ParseException expected) { + } catch (IllegalArgumentException|ParseException expected) { + System.err.println("As expected, with message: "+expected.getMessage()); // success } } @@ -46,7 +48,17 @@ public class StructTestCase extends AbstractSchemaTestCase { */ @Test(expected = IllegalArgumentException.class) public void testStructOutsideDocumentIllegal() throws IOException, ParseException { - ApplicationBuilder.buildFromFile("src/test/examples/structoutsideofdocument.sd"); + var builder = new ApplicationBuilder(new TestProperties().setExperimentalSdParsing(false)); + builder.addSchemaFile("src/test/examples/structoutsideofdocument.sd"); + } + + /** + * Declaring a struct before a document should work + */ + @Test + public void testStructOutsideDocumentLegal() throws IOException, ParseException { + var builder = new ApplicationBuilder(new TestProperties().setExperimentalSdParsing(true)); + builder.addSchemaFile("src/test/examples/structoutsideofdocument.sd"); } } |