INT-3035 Fix ExponentialMovingAverageRate 'window'
'window' constructor arg was not used. Add test.
This commit is contained in:
committed by
Mark Fisher
parent
91afaedbe2
commit
50e728f9e0
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user