diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-06-22 17:52:49 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-06-22 17:52:49 +0200 |
commit | db44411be03f7770456240ff11ed33a4cfe53725 (patch) | |
tree | a9e6890c521402034584db47694288dfaf511fa7 /hosted-api/src/test | |
parent | 1007b2fc5878f3abd3c49bc4cace2cfb673f050e (diff) |
TestDescriptor: Add JSON serialization and construction from non-JSON
Diffstat (limited to 'hosted-api/src/test')
-rw-r--r-- | hosted-api/src/test/java/ai/vespa/hosted/api/TestDescriptorTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hosted-api/src/test/java/ai/vespa/hosted/api/TestDescriptorTest.java b/hosted-api/src/test/java/ai/vespa/hosted/api/TestDescriptorTest.java index 2676d9d79da..7e59af9ced8 100644 --- a/hosted-api/src/test/java/ai/vespa/hosted/api/TestDescriptorTest.java +++ b/hosted-api/src/test/java/ai/vespa/hosted/api/TestDescriptorTest.java @@ -1,6 +1,7 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.hosted.api; +import com.yahoo.test.json.JsonTestHelper; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -67,4 +68,20 @@ public class TestDescriptorTest { var productionTests = testClassDescriptor.getConfiguredTests(TestDescriptor.TestCategory.productiontest); Assertions.assertIterableEquals(List.of("ai.vespa.test.ProductionTest1", "ai.vespa.test.ProductionTest2"), productionTests); } + + @Test + public void generatesCorrectJson() { + String json = "{\n" + + " \"version\": \"1.0\",\n" + + " \"configuredTests\": {\n" + + " \"systemTests\": [\n" + + " \"ai.vespa.test.SystemTest1\",\n" + + " \"ai.vespa.test.SystemTest2\"\n" + + " ]\n" + + " " + + " }\n" + + "}\n"; + var descriptor = TestDescriptor.fromJsonString(json); + JsonTestHelper.assertJsonEquals(json, descriptor.toJson()); + } } |