use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class ConstantLineSerializerTest method serializeVisibleConstantLine_resultJsonHasVisible.
@Test
public void serializeVisibleConstantLine_resultJsonHasVisible() throws IOException {
// when
ConstantLine constantLine = new ConstantLine();
constantLine.setVisible(true);
constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("visible")).isTrue();
Assertions.assertThat(actualObj.get("visible").asBoolean()).isTrue();
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class ConstantLineSerializerTest method serializeConstantLine_resultJsonHasType.
@Test
public void serializeConstantLine_resultJsonHasType() throws IOException {
// when
ConstantLine constantLine = new ConstantLine() {
};
constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("type")).isTrue();
Assertions.assertThat(actualObj.get("type").asText()).isEqualTo("ConstantLine");
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class ConstantLineSerializerTest method serializeYConstantLine_resultJsonHasY.
@Test
public void serializeYConstantLine_resultJsonHasY() throws IOException {
// when
ConstantLine constantLine = new ConstantLine();
constantLine.setY(1);
constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("y")).isTrue();
Assertions.assertThat(actualObj.get("y").asInt()).isEqualTo(1);
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.
the class XYChartTest method shouldSendCommMsgWhenAddConstantLineByLeftShift.
@Test
public void shouldSendCommMsgWhenAddConstantLineByLeftShift() throws Exception {
// given
XYChart xyChart = createWidget();
// when
xyChart.leftShift(new ConstantLine());
// then
List valueAsArray = getValueAsArray(CONSTANT_LINES);
Map actual = (Map) valueAsArray.get(0);
assertThat(actual.get(ConstantLineSerializer.TYPE)).isEqualTo(ConstantLine.class.getSimpleName());
}
Aggregations