Search in sources :

Example 1 with CategoryLines

use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines in project beakerx by twosigma.

the class PlotObjectSerializerTest method serializeCategoryGraphics_returnTrue.

@Test
public void serializeCategoryGraphics_returnTrue() throws Exception {
    // when
    boolean result = plotObjectSerializer.writeObject(new CategoryLines(), jgen, true);
    // then
    Assertions.assertThat(result).isTrue();
}
Also used : CategoryLines(com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 2 with CategoryLines

use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines in project beakerx by twosigma.

the class CategoryLinesSerializerTest method serializeWidthCategoryLines_resultJsonHasWidth.

@Test
public void serializeWidthCategoryLines_resultJsonHasWidth() throws IOException {
    // when
    CategoryLines categoryLines = new CategoryLines();
    categoryLines.setWidth(11f);
    categoryLinesSerializer.serialize(categoryLines, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("width")).isTrue();
    Assertions.assertThat(actualObj.get("width").asInt()).isEqualTo(11);
}
Also used : CategoryLines(com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines) DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 3 with CategoryLines

use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines in project beakerx by twosigma.

the class CategoryLinesSerializerTest method serializeStrokeTypeStems_resultJsonHasStyle.

@Test
public void serializeStrokeTypeStems_resultJsonHasStyle() throws IOException {
    // when
    CategoryLines categoryLines = new CategoryLines();
    categoryLines.setStyle(StrokeType.SOLID);
    categoryLinesSerializer.serialize(categoryLines, 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");
}
Also used : CategoryLines(com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines) DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 4 with CategoryLines

use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines in project beakerx by twosigma.

the class CategoryLinesSerializerTest method serializeInterpolationCategoryLines_resultJsonHasInterpolation.

@Test
public void serializeInterpolationCategoryLines_resultJsonHasInterpolation() throws IOException {
    // when
    CategoryLines categoryLines = new CategoryLines();
    categoryLines.setInterpolation(1);
    categoryLinesSerializer.serialize(categoryLines, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("interpolation")).isTrue();
    Assertions.assertThat(actualObj.get("interpolation").asInt()).isEqualTo(1);
}
Also used : CategoryLines(com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines) DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 5 with CategoryLines

use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines in project beakerx by twosigma.

the class CategoryLinesSerializerTest method serializeStrokeTypeListStems_resultJsonHasStyles.

@Test
public void serializeStrokeTypeListStems_resultJsonHasStyles() throws IOException {
    // when
    CategoryLines categoryLines = new CategoryLines();
    categoryLines.setStyle(Arrays.asList(StrokeType.SOLID, StrokeType.DASHDOT));
    categoryLinesSerializer.serialize(categoryLines, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("styles")).isTrue();
    ArrayNode arrayNode = (ArrayNode) actualObj.get("styles");
    Assertions.assertThat(arrayNode.get(1).asText()).isEqualTo("DASHDOT");
}
Also used : CategoryLines(com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines) DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) Test(org.junit.Test)

Aggregations

CategoryLines (com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryLines)6 Test (org.junit.Test)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 DefaultSerializerProvider (com.fasterxml.jackson.databind.ser.DefaultSerializerProvider)4 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 KernelTest (com.twosigma.beakerx.KernelTest)1 CategoryBars (com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars)1 CategoryPoints (com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints)1 CategoryStems (com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryStems)1 Before (org.junit.Before)1