INT-3035 Fix ExponentialMovingAverageRate 'window'

'window' constructor arg was not used.

Add test.
This commit is contained in:
Gary Russell
2013-05-27 11:24:58 -04:00
committed by Mark Fisher
parent 91afaedbe2
commit 50e728f9e0
2 changed files with 17 additions and 7 deletions

View File

@@ -21,6 +21,8 @@ import org.apache.commons.logging.LogFactory;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.integration.test.util.TestUtils;
/**
* @author Dave Syer
* @author Gary Russell
@@ -32,6 +34,13 @@ public class ExponentialMovingAverageRateTests {
private final ExponentialMovingAverageRate history = new ExponentialMovingAverageRate(1., 10., 10);
@Test
public void testWindow() {
ExponentialMovingAverageRate rate = new ExponentialMovingAverageRate(1., 10., 20);
double decay = TestUtils.getPropertyValue(rate, "rates.decay", Double.class);
assertEquals(95, (int) (decay * 100.));
}
@Test
public void testGetCount() {
assertEquals(0, history.getCount());