use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPointsSerializerTest method serializeShapeCategoryPoints_resultJsonHasShape.
@Test
public void serializeShapeCategoryPoints_resultJsonHasShape() throws IOException {
// when
CategoryPoints categoryPoints = new CategoryPoints();
categoryPoints.setShape(ShapeType.CIRCLE);
categoryPointsSerializer.serialize(categoryPoints, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("shape")).isTrue();
Assertions.assertThat(actualObj.get("shape").asText()).isEqualTo("CIRCLE");
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPointsSerializerTest method serializeFillsCategoryPoints_resultJsonHasFills.
@Test
public void serializeFillsCategoryPoints_resultJsonHasFills() throws IOException {
// when
CategoryPoints categoryPoints = new CategoryPoints();
categoryPoints.setFill(Arrays.asList(false, true, false));
categoryPointsSerializer.serialize(categoryPoints, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("fills")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("fills");
Assertions.assertThat(arrayNode.get(1).asBoolean()).isTrue();
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPointsSerializerTest method serializeShapesCategoryPoints_resultJsonHasShapes.
@Test
public void serializeShapesCategoryPoints_resultJsonHasShapes() throws IOException {
// when
CategoryPoints categoryPoints = new CategoryPoints();
categoryPoints.setShape(Arrays.asList(ShapeType.CIRCLE, ShapeType.TRIANGLE));
categoryPointsSerializer.serialize(categoryPoints, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("shaps")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("shaps");
Assertions.assertThat(arrayNode.get(1).asText()).isEqualTo("TRIANGLE");
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPointsSerializerTest method serializeOutlineColorsCategoryPoints_resultJsonHasOutlineColors.
@Test
public void serializeOutlineColorsCategoryPoints_resultJsonHasOutlineColors() throws IOException {
// when
CategoryPoints categoryPoints = new CategoryPoints();
categoryPoints.setOutlineColor(Arrays.asList(Color.BLUE, Color.GREEN, Color.BLACK));
categoryPointsSerializer.serialize(categoryPoints, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("outline_colors")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("outline_colors");
Assertions.assertThat(arrayNode.get(1).get("rgb").asInt()).isEqualTo(Color.GREEN.getRGB());
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryPoints in project beakerx by twosigma.
the class CategoryPlotTest method initStubData.
@Before
public void initStubData() {
array1 = new Integer[] { new Integer(1), new Integer(2) };
array2 = new Integer[] { new Integer(3), new Integer(4) };
categoryBars = new CategoryBars();
categoryBars.setValue(new List[] { Arrays.asList(array1), Arrays.asList(array2) });
categoryLines = new CategoryLines();
categoryLines.setValue(new List[] { Arrays.asList(array1), Arrays.asList(array2) });
categoryPoints = new CategoryPoints();
categoryPoints.setValue(new List[] { Arrays.asList(array1), Arrays.asList(array2) });
categoryStems = new CategoryStems();
categoryStems.setValue(new List[] { Arrays.asList(array1), Arrays.asList(array2) });
}
Aggregations