Add test for union type 05/106505/24
authortobias.pobocik <tobias.pobocik@pantheon.tech>
Fri, 16 Jun 2023 10:29:33 +0000 (12:29 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 22 Sep 2023 19:18:38 +0000 (19:18 +0000)
Previously, a test was missing to make sure that the proper
type was registered in union type.

JIRA: NETCONF-1058
Change-Id: Ifd6ea086014e13de88ffd50bfb6b2fd1eeb05530
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
restconf/restconf-openapi/src/test/java/org/opendaylight/restconf/openapi/impl/DefinitionGeneratorTest.java

index 62d1418d44fa272dc5205335584647e116781736..d88727dcd17c514ce81c8263102765870cba745e 100644 (file)
@@ -71,7 +71,14 @@ public final class DefinitionGeneratorTest {
 
         final var properties = schemas.get("definition-test_union-container").properties();
         assertEquals("5", properties.get("testUnion1").defaultValue());
+        assertEquals("integer", properties.get("testUnion1").type());
+        assertEquals(-2147483648, properties.get("testUnion1").example());
         assertEquals("false", properties.get("testUnion2").defaultValue());
+        assertEquals("string", properties.get("testUnion2").type());
+        assertEquals("Some testUnion2", properties.get("testUnion2").example());
+        assertEquals("integer", properties.get("testUnion3").type());
+        assertEquals(-2147483648, properties.get("testUnion3").example());
+        assertEquals("false", properties.get("testUnion3").defaultValue());
     }
 
     @Test