use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class ConstantLineSerializerTest method serializeXConstantLine_resultJsonHasX.
@Test
public void serializeXConstantLine_resultJsonHasX() throws IOException {
// when
ConstantLine constantLine = new ConstantLine();
constantLine.setX(1);
constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("x")).isTrue();
Assertions.assertThat(actualObj.get("x").asInt()).isEqualTo(1);
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class ConstantLineSerializerTest method serializeStyleConstantLine_resultJsonHasStyle.
@Test
public void serializeStyleConstantLine_resultJsonHasStyle() throws IOException {
// when
ConstantLine constantLine = new ConstantLine();
constantLine.setStyle(StrokeType.SOLID);
constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("style")).isTrue();
Assertions.assertThat(actualObj.get("style").asText()).isEqualTo("SOLID");
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class ConstantLineSerializerTest method serializeBigIntXWithNanoPlotType_resultJsonHasStringX.
@Test
public void serializeBigIntXWithNanoPlotType_resultJsonHasStringX() throws IOException {
// when
ConstantLine constantLine = new ConstantLine();
constantLine.setX(new BigInteger("12345678901234567891000"));
constantLine.setPlotType(NanoPlot.class);
constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("x")).isTrue();
Assertions.assertThat(actualObj.get("x").isTextual()).isTrue();
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class ConstantLineSerializerTest method serializeShowLabelConstantLine_resultJsonHasShowLabel.
@Test
public void serializeShowLabelConstantLine_resultJsonHasShowLabel() throws IOException {
// when
ConstantLine constantLine = new ConstantLine();
constantLine.setShowLabel(true);
constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("showLabel")).isTrue();
Assertions.assertThat(actualObj.get("showLabel").asBoolean()).isTrue();
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class ConstantLineSerializerTest method serializeWidthConstantLine_resultJsonHasWidth.
@Test
public void serializeWidthConstantLine_resultJsonHasWidth() throws IOException {
// when
ConstantLine constantLine = new ConstantLine();
constantLine.setWidth(2f);
constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("width")).isTrue();
Assertions.assertThat(actualObj.get("width").asDouble()).isEqualTo(2.0);
}
Aggregations