Search in sources :

Example 1 with ConstantLine

use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.

the class ConstantLineSerializerTest method serializeXConstantLine_resultJsonHasX.

@Test
public void serializeXConstantLine_resultJsonHasX() throws IOException {
    // when
    ConstantLine constantLine = new ConstantLine();
    constantLine.setX(1);
    constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("x")).isTrue();
    Assertions.assertThat(actualObj.get("x").asInt()).isEqualTo(1);
}
Also used : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) ConstantLine(com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine) Test(org.junit.Test)

Example 2 with ConstantLine

use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.

the class ConstantLineSerializerTest method serializeStyleConstantLine_resultJsonHasStyle.

@Test
public void serializeStyleConstantLine_resultJsonHasStyle() throws IOException {
    // when
    ConstantLine constantLine = new ConstantLine();
    constantLine.setStyle(StrokeType.SOLID);
    constantLineSerializer.serialize(constantLine, 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 : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) ConstantLine(com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine) Test(org.junit.Test)

Example 3 with ConstantLine

use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.

the class ConstantLineSerializerTest method serializeBigIntXWithNanoPlotType_resultJsonHasStringX.

@Test
public void serializeBigIntXWithNanoPlotType_resultJsonHasStringX() throws IOException {
    // when
    ConstantLine constantLine = new ConstantLine();
    constantLine.setX(new BigInteger("12345678901234567891000"));
    constantLine.setPlotType(NanoPlot.class);
    constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("x")).isTrue();
    Assertions.assertThat(actualObj.get("x").isTextual()).isTrue();
}
Also used : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) BigInteger(java.math.BigInteger) JsonNode(com.fasterxml.jackson.databind.JsonNode) ConstantLine(com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine) Test(org.junit.Test)

Example 4 with ConstantLine

use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.

the class ConstantLineSerializerTest method serializeShowLabelConstantLine_resultJsonHasShowLabel.

@Test
public void serializeShowLabelConstantLine_resultJsonHasShowLabel() throws IOException {
    // when
    ConstantLine constantLine = new ConstantLine();
    constantLine.setShowLabel(true);
    constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("showLabel")).isTrue();
    Assertions.assertThat(actualObj.get("showLabel").asBoolean()).isTrue();
}
Also used : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) ConstantLine(com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine) Test(org.junit.Test)

Example 5 with ConstantLine

use of com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine in project beakerx by twosigma.

the class ConstantLineSerializerTest method serializeWidthConstantLine_resultJsonHasWidth.

@Test
public void serializeWidthConstantLine_resultJsonHasWidth() throws IOException {
    // when
    ConstantLine constantLine = new ConstantLine();
    constantLine.setWidth(2f);
    constantLineSerializer.serialize(constantLine, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("width")).isTrue();
    Assertions.assertThat(actualObj.get("width").asDouble()).isEqualTo(2.0);
}
Also used : DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) JsonNode(com.fasterxml.jackson.databind.JsonNode) ConstantLine(com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine) Test(org.junit.Test)

Aggregations

ConstantLine (com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine)14 Test (org.junit.Test)13 JsonNode (com.fasterxml.jackson.databind.JsonNode)11 DefaultSerializerProvider (com.fasterxml.jackson.databind.ser.DefaultSerializerProvider)11 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 KernelTest (com.twosigma.beakerx.KernelTest)1 AbstractChartTest (com.twosigma.beakerx.chart.AbstractChartTest)1 ConstantBand (com.twosigma.beakerx.chart.xychart.plotitem.ConstantBand)1 Rasters (com.twosigma.beakerx.chart.xychart.plotitem.Rasters)1 Text (com.twosigma.beakerx.chart.xychart.plotitem.Text)1 BigInteger (java.math.BigInteger)1 Map (java.util.Map)1