From 1805ddbdbcf94a8b89d656fbfa8126228aea8cf3 Mon Sep 17 00:00:00 2001 From: Hwaipy Li <hwaipy@gmail.com> Date: Thu, 5 Mar 2015 20:18:57 +0800 Subject: [PATCH] add an UnitTest for Histogram To avoid the tempMax problem --- xchart/src/test/java/com/xeiam/xchart/HistogramTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xchart/src/test/java/com/xeiam/xchart/HistogramTest.java b/xchart/src/test/java/com/xeiam/xchart/HistogramTest.java index ebe3a080..d21b67e0 100644 --- a/xchart/src/test/java/com/xeiam/xchart/HistogramTest.java +++ b/xchart/src/test/java/com/xeiam/xchart/HistogramTest.java @@ -40,5 +40,13 @@ public class HistogramTest { // chart.addSeries("histogram 1", histogram.getxAxisData(), histogram.getyAxisData()); // new SwingWrapper(chart).displayChart(); + }@Test + public void testNegetiveValues() { + + Histogram histogram = new Histogram(Arrays.asList(-1, -2, -3, -4, -5, -6),3); + + assertThat(histogram.getMax()).isEqualTo(-1); + assertThat(histogram.getMin()).isEqualTo(-6); + assertThat(histogram.getNumBins()).isEqualTo(3); } } -- GitLab