use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeWidthCategoryBars_resultJsonHasWidth.
@Test
public void serializeWidthCategoryBars_resultJsonHasWidth() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setWidth(11);
categoryBarsSerializer.serialize(categoryBars, 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);
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeWidthsCategoryBars_resultJsonHasWidths.
@Test
public void serializeWidthsCategoryBars_resultJsonHasWidths() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setWidth(Arrays.asList(11, 22, 33));
categoryBarsSerializer.serialize(categoryBars, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("widths")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("widths");
Assertions.assertThat(arrayNode.get(1).asInt()).isEqualTo(22);
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeOutlineColorsCategoryBars_resultJsonHasOutlineColors.
@Test
public void serializeOutlineColorsCategoryBars_resultJsonHasOutlineColors() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setOutlineColor(Arrays.asList(Color.BLUE, Color.GREEN, Color.BLACK));
categoryBarsSerializer.serialize(categoryBars, 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.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeBasesCategoryBars_resultJsonHasBases.
@Test
public void serializeBasesCategoryBars_resultJsonHasBases() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setBase(Arrays.asList(11, 22, 33));
categoryBarsSerializer.serialize(categoryBars, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("bases")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("bases");
Assertions.assertThat(arrayNode.get(1).asInt()).isEqualTo(22);
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeFillCategoryBars_resultJsonHasFill.
@Test
public void serializeFillCategoryBars_resultJsonHasFill() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setFill(true);
categoryBarsSerializer.serialize(categoryBars, 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();
}
Aggregations