|
From: Márcio V. d. S. <mv...@us...> - 2007-05-19 12:37:57
|
Update of /cvsroot/tail/Tail/src/test/net/sf/tail/strategy In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9952/src/test/net/sf/tail/strategy Added Files: IndicatorOverIndicatorStrategyTest.java Log Message: Movendo o pacote strategy do teste para o src --- NEW FILE: IndicatorOverIndicatorStrategyTest.java --- package net.sf.tail.strategy; import static org.junit.Assert.*; import net.sf.tail.Indicator; import net.sf.tail.Operation; import net.sf.tail.OperationType; import net.sf.tail.Strategy; import org.junit.After; import org.junit.Before; import org.junit.Test; public class IndicatorOverIndicatorStrategyTest { private Indicator<Double> first; private Indicator<Double> second; @Before public void setUp() throws Exception { first = new Indicator<Double>() { double values[] = {4,7,9,6,3,2}; public Double getValue(int index) { return values[index]; } }; // mudar para SAmpleIndicator (no pacote de testes mesmo) second = new Indicator<Double>() { double values[] = {3,6,10,8,2,1}; public Double getValue(int index) { return values[index]; } }; } @Test public void testOverIndicators() { Strategy s = new IndicatorOverIndicatorStrategy(first, second); assertEquals(null, s.shouldEnter(0)); assertEquals(null, s.shouldEnter(1)); Operation buy = s.shouldEnter(2); assertNotNull(buy); assertEquals(OperationType.BUY, buy.getType()); assertEquals(null, s.shouldExit(buy, 3)); Operation sell = s.shouldExit(buy, 4); assertNotNull(sell); assertEquals(OperationType.SELL, sell.getType()); } @After public void tearDown() throws Exception { } } |