use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.JSONSchemaPropsOrBoolBuilder in project kubernetes-client by fabric8io.
the class JSONSchemaPropsOrBoolTest method itSerializesAdditionalPropertiesTyped.
@Test
void itSerializesAdditionalPropertiesTyped() throws JsonProcessingException {
String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_typed.json"), StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder().withType("object").withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder().withNewSchema().withType("string").endSchema().build()).build());
Assertions.assertEquals(expectedJson, outputJson);
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.JSONSchemaPropsOrBoolBuilder in project kubernetes-client by fabric8io.
the class JSONSchemaPropsOrBoolTest method itDeserializesAdditionalPropertiesTyped.
@Test
void itDeserializesAdditionalPropertiesTyped() throws IOException {
InputStream resourceAsStream = getClass().getResourceAsStream("/additionalproperties_typed.json");
JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class);
Assertions.assertEquals(props, new JSONSchemaPropsBuilder().withType("object").withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder().withAllows(true).withNewSchema().withType("string").endSchema().build()).build());
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.JSONSchemaPropsOrBoolBuilder in project kubernetes-client by fabric8io.
the class JSONSchemaPropsOrBoolTest method itSerializesAdditionalPropertiesTrue.
@Test
void itSerializesAdditionalPropertiesTrue() throws JsonProcessingException {
String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_true.json"), StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder().withType("object").withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder().withAllows(true).build()).build());
Assertions.assertEquals(expectedJson, outputJson);
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.JSONSchemaPropsOrBoolBuilder in project kubernetes-client by fabric8io.
the class JSONSchemaPropsOrBoolTest method itDeserializesAdditionalPropertiesTrue.
@Test
void itDeserializesAdditionalPropertiesTrue() throws IOException {
InputStream resourceAsStream = getClass().getResourceAsStream("/additionalproperties_true.json");
JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class);
Assertions.assertEquals(props, new JSONSchemaPropsBuilder().withType("object").withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder().withAllows(true).build()).build());
}
Aggregations