use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantBand in project beakerx by twosigma.
the class ConstantBandSerializerTest method serializeConstantBand_resultJsonHasType.
@Test
public void serializeConstantBand_resultJsonHasType() throws IOException {
// when
ConstantBand constantBand = new ConstantBand() {
};
constantBandSerializer.serialize(constantBand, 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("ConstantBand");
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantBand in project beakerx by twosigma.
the class ConstantBandSerializerTest method serializeXConstantBand_resultJsonHasX.
@Test
public void serializeXConstantBand_resultJsonHasX() throws IOException {
// when
ConstantBand constantBand = new ConstantBand();
constantBand.setX(Arrays.asList(1, 2, 3));
constantBandSerializer.serialize(constantBand, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("x")).isTrue();
Assertions.assertThat(actualObj.get("x")).isNotEmpty();
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantBand in project beakerx by twosigma.
the class ConstantBandSerializerTest method serializeYAxisConstantBand_resultJsonHasYAxis.
@Test
public void serializeYAxisConstantBand_resultJsonHasYAxis() throws IOException {
// when
ConstantBand constantBand = new ConstantBand();
constantBand.setyAxis("Y Axis name");
constantBandSerializer.serialize(constantBand, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("yAxis")).isTrue();
Assertions.assertThat(actualObj.get("yAxis").asText()).isEqualTo("Y Axis name");
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantBand in project beakerx by twosigma.
the class ConstantBandSerializerTest method serializeYConstantBand_resultJsonHasY.
@Test
public void serializeYConstantBand_resultJsonHasY() throws IOException {
// when
ConstantBand constantBand = new ConstantBand();
constantBand.setY(Arrays.asList(1, 2, 3));
constantBandSerializer.serialize(constantBand, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("y")).isTrue();
Assertions.assertThat(actualObj.get("y")).isNotEmpty();
}
use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantBand in project beakerx by twosigma.
the class PlotTest method addListOfPlotObjects_hasAllPlotObjects.
@Test
public void addListOfPlotObjects_hasAllPlotObjects() {
// given
Rasters rasters = new Rasters();
List<Number> value = Collections.singletonList(1);
rasters.setY(value);
rasters.setWidth(value);
rasters.setHeight(value);
// when
plot.add(Arrays.asList(line, new ConstantLine(), new ConstantBand(), rasters, new Text()));
// then
assertThat(plot.getGraphics().size()).isEqualTo(1);
assertThat(plot.getConstantLines().size()).isEqualTo(1);
assertThat(plot.getConstantBands().size()).isEqualTo(1);
assertThat(plot.getRasters().size()).isEqualTo(1);
assertThat(plot.getTexts().size()).isEqualTo(1);
}
Aggregations