Search in sources :

Example 1 with Histogram

use of com.twosigma.beakerx.chart.histogram.Histogram in project beakerx by twosigma.

the class PlotObjectSerializerTest method serializeHistogram_returnTrue.

@Test
public void serializeHistogram_returnTrue() throws Exception {
    // when
    boolean result = plotObjectSerializer.writeObject(new Histogram(), jgen, true);
    // then
    Assertions.assertThat(result).isTrue();
}
Also used : Histogram(com.twosigma.beakerx.chart.histogram.Histogram) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 2 with Histogram

use of com.twosigma.beakerx.chart.histogram.Histogram in project beakerx by twosigma.

the class HistogramSerializerTest method initTestStubData.

@Before
public void initTestStubData() throws IOException {
    KernelManager.register(new KernelTest());
    sw = new StringWriter();
    jgen = mapper.getJsonFactory().createJsonGenerator(sw);
    histogram = new Histogram();
}
Also used : Histogram(com.twosigma.beakerx.chart.histogram.Histogram) StringWriter(java.io.StringWriter) KernelTest(com.twosigma.beakerx.KernelTest) Before(org.junit.Before)

Example 3 with Histogram

use of com.twosigma.beakerx.chart.histogram.Histogram in project beakerx by twosigma.

the class GroovyEvaluatorChartTest method parseHistogramScript_returnHistogramObject.

@Test
public void parseHistogramScript_returnHistogramObject() {
    // when
    Object result = parseClassFromScript("Random random = new Random();\n" + "data3 = [];\n" + "(1..10000).each { data3 << random.nextGaussian();}\n" + "new Histogram(data: data3, binCount: 25);");
    // then
    Assertions.assertThat(result instanceof Histogram).isTrue();
    Histogram histogram = (Histogram) result;
    Assertions.assertThat(histogram.getData()).isNotEmpty();
}
Also used : Histogram(com.twosigma.beakerx.chart.histogram.Histogram) Test(org.junit.Test)

Aggregations

Histogram (com.twosigma.beakerx.chart.histogram.Histogram)3 KernelTest (com.twosigma.beakerx.KernelTest)2 Test (org.junit.Test)2 StringWriter (java.io.StringWriter)1 Before (org.junit.Before)1