use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPointsSerializerTest method serializeSizesCategoryPoints_resultJsonHasSizes.
@Test
public void serializeSizesCategoryPoints_resultJsonHasSizes() throws IOException {
// when
CategoryPoints categoryPoints = new CategoryPoints();
categoryPoints.setSize(Arrays.asList(11, 22, 33));
categoryPointsSerializer.serialize(categoryPoints, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("sizes")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("sizes");
Assertions.assertThat(arrayNode.get(1).asInt()).isEqualTo(22);
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPointsSerializerTest method serializeFillCategoryPoints_resultJsonHasFill.
@Test
public void serializeFillCategoryPoints_resultJsonHasFill() throws IOException {
// when
CategoryPoints categoryPoints = new CategoryPoints();
categoryPoints.setFill(true);
categoryPointsSerializer.serialize(categoryPoints, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("fill")).isTrue();
Assertions.assertThat(actualObj.get("fill").asBoolean()).isTrue();
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPointsSerializerTest method serializeOutlineColorCategoryPoints_resultJsonHasOutlineColor.
@Test
public void serializeOutlineColorCategoryPoints_resultJsonHasOutlineColor() throws IOException {
// when
CategoryPoints categoryPoints = new CategoryPoints();
categoryPoints.setOutlineColor(Color.GREEN);
categoryPointsSerializer.serialize(categoryPoints, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("outline_color")).isTrue();
Assertions.assertThat(actualObj.get("outline_color").get("rgb").asInt()).isEqualTo(Color.GREEN.getRGB());
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPlotSerializerTest method serializeGraphicsListCategoryPlot_resultJsonHasGraphicsList.
@Test
public void serializeGraphicsListCategoryPlot_resultJsonHasGraphicsList() throws IOException {
// when
CategoryPlot categoryPlot = new CategoryPlot();
categoryPlot.add(Arrays.asList(new CategoryBars(), new CategoryPoints()));
categoryPlotSerializer.serialize(categoryPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("graphics_list")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("graphics_list");
Assertions.assertThat(arrayNode.size()).isEqualTo(2);
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPointsSerializerTest method serializeSizeCategoryPoints_resultJsonHasSize.
@Test
public void serializeSizeCategoryPoints_resultJsonHasSize() throws IOException {
// when
CategoryPoints categoryPoints = new CategoryPoints();
categoryPoints.setSize(11);
categoryPointsSerializer.serialize(categoryPoints, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("size")).isTrue();
Assertions.assertThat(actualObj.get("size").asInt()).isEqualTo(11);
}
Aggregations