use of com.github.victools.jsonschema.generator.Option in project jsonschema-generator by victools.
the class AttributeCollectorTest method testSetEnum_twoEnumValues.
@Test
@Parameters({ "default", "ENUM_KEYWORD_FOR_SINGLE_VALUES" })
public void testSetEnum_twoEnumValues(String optionMode) {
Option[] options = optionMode.equals("default") ? new Option[0] : new Option[] { Option.ENUM_KEYWORD_FOR_SINGLE_VALUES };
this.collector.setEnum(this.definitionNode, Arrays.asList("A", "B"), this.generateContext(SchemaVersion.DRAFT_2019_09, options));
JsonNode enumNode = this.definitionNode.get(SchemaKeyword.TAG_ENUM.forVersion(SchemaVersion.DRAFT_2019_09));
Assert.assertNotNull(enumNode);
Assert.assertTrue(enumNode.isArray());
Assert.assertEquals(2, enumNode.size());
JsonNode firstValueItem = enumNode.get(0);
Assert.assertNotNull(firstValueItem);
Assert.assertTrue(firstValueItem.isTextual());
Assert.assertEquals("A", firstValueItem.textValue());
JsonNode secondValueItem = enumNode.get(1);
Assert.assertNotNull(secondValueItem);
Assert.assertTrue(secondValueItem.isTextual());
Assert.assertEquals("B", secondValueItem.textValue());
}
Aggregations