use of io.kubernetes.client.proto.IntStr.IntOrString in project seldon-core by SeldonIO.
the class JsonFormatTest method testIntValCustomFormat.
@Test
public void testIntValCustomFormat() throws InvalidProtocolBufferException {
final int val = 1;
IntOrString is = IntOrString.newBuilder().setIntVal(val).build();
Printer jf = JsonFormat.printer().usingTypeConverter(is.getDescriptorForType().getFullName(), new IntOrStringUtils.IntOrStringConverter());
Assert.assertTrue(jf.print(is).equals("" + val));
}
use of io.kubernetes.client.proto.IntStr.IntOrString in project seldon-core by SeldonIO.
the class JsonFormatTest method testStrValCustomFormat.
@Test
public void testStrValCustomFormat() throws InvalidProtocolBufferException {
final String val = "String Value";
IntOrString is = IntOrString.newBuilder().setStrVal(val).build();
Printer jf = JsonFormat.printer().usingTypeConverter(is.getDescriptorForType().getFullName(), new IntOrStringUtils.IntOrStringConverter());
Assert.assertTrue(jf.print(is).equals("\"" + val + "\""));
}
use of io.kubernetes.client.proto.IntStr.IntOrString in project seldon-core by SeldonIO.
the class JsonFormatTest method testStrValDefaultFormat.
@Test
public void testStrValDefaultFormat() throws InvalidProtocolBufferException {
final String val = "String Value";
IntOrString is = IntOrString.newBuilder().setStrVal(val).build();
Printer jf = JsonFormat.printer().omittingInsignificantWhitespace();
Assert.assertTrue(jf.print(is).equals("{\"strVal\":\"" + val + "\"}"));
}
use of io.kubernetes.client.proto.IntStr.IntOrString in project seldon-core by SeldonIO.
the class JsonFormatTest method testIntValDefaultFormat.
@Test
public void testIntValDefaultFormat() throws InvalidProtocolBufferException {
final int val = 1;
IntOrString is = IntOrString.newBuilder().setIntVal(val).build();
Printer jf = JsonFormat.printer().omittingInsignificantWhitespace();
Assert.assertTrue(jf.print(is).equals("{\"intVal\":" + val + "}"));
}
Aggregations