Package com.vladmihalcea.flexypool.metric.codahale

Source Code of com.vladmihalcea.flexypool.metric.codahale.CodahaleHistogramTest

package com.vladmihalcea.flexypool.metric.codahale;

import com.codahale.metrics.ExponentiallyDecayingReservoir;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
* CodahaleHistogramTest - CodahaleHistogram Test
*
* @author Vlad Mihalcea
*/
public class CodahaleHistogramTest {

    private com.codahale.metrics.Histogram histogram;

    private CodahaleHistogram histogramWrapper;

    @Before
    public void before() {
        histogram = new com.codahale.metrics.Histogram(new ExponentiallyDecayingReservoir());
        histogramWrapper = new CodahaleHistogram(histogram);
    }

    @Test
    public void testUpdate() {
        assertEquals(0, histogram.getCount());
        histogramWrapper.update(100);
        assertEquals(1, histogram.getCount());
        assertEquals(100, histogram.getSnapshot().getValues()[0]);
    }
}
TOP

Related Classes of com.vladmihalcea.flexypool.metric.codahale.CodahaleHistogramTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.