Search in sources :

Example 6 with CombinedPlot

use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.

the class CombinedPlotSerializerTest method serializeWeightsOfCombinedPlot_resultJsonHasWeights.

@Test
public void serializeWeightsOfCombinedPlot_resultJsonHasWeights() throws IOException {
    // when
    CombinedPlot combinedPlot = new CombinedPlot();
    combinedPlot.add(new Plot(), 3);
    combinedPlot.add(new Plot(), 3);
    combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("weights")).isTrue();
    Assertions.assertThat(actualObj.get("weights")).isNotEmpty();
}
Also used : SimpleTimePlot(com.twosigma.beakerx.chart.xychart.SimpleTimePlot) CombinedPlot(com.twosigma.beakerx.chart.xychart.CombinedPlot) Plot(com.twosigma.beakerx.chart.xychart.Plot) DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) CombinedPlot(com.twosigma.beakerx.chart.xychart.CombinedPlot) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 7 with CombinedPlot

use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.

the class CombinedPlotSerializerTest method serializeTitleOfCombinedPlot_resultJsonHasTitle.

@Test
public void serializeTitleOfCombinedPlot_resultJsonHasTitle() throws IOException {
    // when
    CombinedPlot combinedPlot = new CombinedPlot();
    combinedPlot.setTitle("Some title");
    combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("title")).isTrue();
    Assertions.assertThat(actualObj.get("title").asText()).isEqualTo("Some title");
}
Also used : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) CombinedPlot(com.twosigma.beakerx.chart.xychart.CombinedPlot) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 8 with CombinedPlot

use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.

the class CombinedPlotSerializerTest method serializeCombinedPlot_resultJsonHasType.

@Test
public void serializeCombinedPlot_resultJsonHasType() throws IOException {
    // when
    CombinedPlot combinedPlot = new CombinedPlot();
    combinedPlotSerializer.serialize(combinedPlot, 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("CombinedPlot");
}
Also used : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) CombinedPlot(com.twosigma.beakerx.chart.xychart.CombinedPlot) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 9 with CombinedPlot

use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.

the class CombinedPlotSerializerTest method serializeXLabelNameOfCombinedPlot_resultJsonHasXLabelName.

@Test
public void serializeXLabelNameOfCombinedPlot_resultJsonHasXLabelName() throws IOException {
    // when
    CombinedPlot combinedPlot = new CombinedPlot();
    combinedPlot.setXLabel("X label name");
    combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("x_label")).isTrue();
    Assertions.assertThat(actualObj.get("x_label").asText()).isEqualTo("X label name");
}
Also used : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) CombinedPlot(com.twosigma.beakerx.chart.xychart.CombinedPlot) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 10 with CombinedPlot

use of com.twosigma.beakerx.chart.xychart.CombinedPlot in project beakerx by twosigma.

the class CombinedPlotSerializerTest method serializeYTickLabelsVisibleOfCombinedPlot_resultJsonHasYTickLabelsVisible.

@Test
public void serializeYTickLabelsVisibleOfCombinedPlot_resultJsonHasYTickLabelsVisible() throws IOException {
    // when
    CombinedPlot combinedPlot = new CombinedPlot();
    combinedPlot.setyTickLabelsVisible(true);
    combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("y_tickLabels_visible")).isTrue();
    Assertions.assertThat(actualObj.get("y_tickLabels_visible").asBoolean()).isTrue();
}
Also used : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) CombinedPlot(com.twosigma.beakerx.chart.xychart.CombinedPlot) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Aggregations

CombinedPlot (com.twosigma.beakerx.chart.xychart.CombinedPlot)15 Test (org.junit.Test)14 KernelTest (com.twosigma.beakerx.KernelTest)13 JsonNode (com.fasterxml.jackson.databind.JsonNode)12 DefaultSerializerProvider (com.fasterxml.jackson.databind.ser.DefaultSerializerProvider)12 SimpleTimePlot (com.twosigma.beakerx.chart.xychart.SimpleTimePlot)4 Plot (com.twosigma.beakerx.chart.xychart.Plot)3 CategoryPlot (com.twosigma.beakerx.chart.categoryplot.CategoryPlot)1 XYChart (com.twosigma.beakerx.chart.xychart.XYChart)1