use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.
the class CombinedPlotSerializerTest method serializePlotTypeOfCombinedPlot_resultJsonHasPlotType.
@Test
public void serializePlotTypeOfCombinedPlot_resultJsonHasPlotType() throws IOException {
// when
CombinedPlot combinedPlot = new CombinedPlot();
combinedPlot.add(new Plot());
combinedPlot.add(new Plot());
combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("plot_type")).isTrue();
Assertions.assertThat(actualObj.get("plot_type").asText()).isEqualTo("Plot");
}
use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.
the class CombinedPlotSerializerTest method serializePlotsOfCombinedPlot_resultJsonHasPlots.
@Test
public void serializePlotsOfCombinedPlot_resultJsonHasPlots() throws IOException {
// when
CombinedPlot combinedPlot = new CombinedPlot();
combinedPlot.add(new Plot());
combinedPlot.add(new Plot());
combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("plots")).isTrue();
Assertions.assertThat(actualObj.get("plots")).isNotEmpty();
}
use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.
the class CombinedPlotSerializerTest method serializeXTickLabelsVisibleOfCombinedPlot_resultJsonHasXTickLabelsVisible.
@Test
public void serializeXTickLabelsVisibleOfCombinedPlot_resultJsonHasXTickLabelsVisible() throws IOException {
// when
CombinedPlot combinedPlot = new CombinedPlot();
combinedPlot.setxTickLabelsVisible(true);
combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("x_tickLabels_visible")).isTrue();
Assertions.assertThat(actualObj.get("x_tickLabels_visible").asBoolean()).isTrue();
}
use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.
the class CombinedPlotSerializerTest method serializeInitWidthOfCombinedPlot_resultJsonHasInitWidth.
@Test
public void serializeInitWidthOfCombinedPlot_resultJsonHasInitWidth() throws IOException {
// when
CombinedPlot combinedPlot = new CombinedPlot();
combinedPlot.setInitWidth(600);
combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("init_width")).isTrue();
Assertions.assertThat(actualObj.get("init_width").asInt()).isEqualTo(600);
}
use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parseCombinedPlotScript_returnCombinedPlotObjectWithSubplots.
@Test
public void parseCombinedPlotScript_returnCombinedPlotObjectWithSubplots() {
// when
Object result = parseClassFromScript("def cplot = new CombinedPlot(xLabel: \"Linear\");\n" + "cplot.add(new Plot())\n" + "cplot.add(new Plot())\n" + "cplot");
// then
Assertions.assertThat(result instanceof CombinedPlot).isTrue();
CombinedPlot combinedPlot = (CombinedPlot) result;
Assertions.assertThat(combinedPlot.getSubplots()).isNotEmpty();
}
Aggregations