/**
 * Copyright 2013 Xeiam LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.xeiam.xchart;

import static org.fest.assertions.api.Assertions.assertThat;

import java.util.Arrays;

import org.junit.Test;

/**
 * @author timmolter
 */
public class HistogramTest {

  @Test
  public void test1() {

    Histogram histogram = new Histogram(Arrays.asList(1, 2, 3, 4, 5, 6), 2, 0, 4);

    assertThat(histogram.getMax()).isEqualTo(4.0);
    assertThat(histogram.getMin()).isEqualTo(0.0);
    assertThat(histogram.getNumBins()).isEqualTo(2);
    assertThat(histogram.getyAxisData().get(0) + histogram.getyAxisData().get(1)).isEqualTo(4);

    //    Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).build();
    //    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);
  }
}

@@ -676,17 +676,16 @@
 rtThat;%0A
-%0A
 import j
@@ -701,17 +701,16 @@
 Arrays;%0A
-%0A
 import o
@@ -1400,13 +1400,16 @@
 t();
+%0A  %7D
 %0A%0A  
-%7D
 @Tes
@@ -1526,16 +1526,17 @@
 -5, -6),
+ 
 3);%0A%0A   
@@ -1689,10 +1689,11 @@
 3);%0A  %7D%0A
+%0A
 %7D%0A

add an UnitTest for Histogram