|
From: Thies <tg...@us...> - 2007-05-24 18:50:31
|
Update of /cvsroot/tail/Tail/src/test/net/sf/tail/strategy In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv3693/src/test/net/sf/tail/strategy Added Files: MinValueStarterStrategyTest.java Log Message: Testes para estratégia de start. --- NEW FILE: MinValueStarterStrategyTest.java --- package net.sf.tail.strategy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import net.sf.tail.Operation; import net.sf.tail.OperationType; import net.sf.tail.Strategy; import net.sf.tail.sample.SampleIndicator; import org.junit.Before; import org.junit.Test; public class MinValueStarterStrategyTest { private SampleIndicator indicator; @Before public void setUp() throws Exception { indicator = new SampleIndicator(new double[] {90,92,96,95,94}); } @Test public void testStarterShouldWork() { Strategy neverBuy = new FakeStratetgy( new Operation[] { null, null, null, null, null } , new Operation[] { null, null, null, null, null }); Strategy stopper = new MinValueStarterStrategy(indicator,neverBuy, 93); assertNull(stopper.shouldEnter(0)); assertNull(stopper.shouldEnter(1)); Operation buy = new Operation(2,OperationType.BUY); assertEquals(buy, stopper.shouldEnter(2)); buy = new Operation(3,OperationType.BUY); assertEquals(buy, stopper.shouldEnter(3)); buy = new Operation(4,OperationType.BUY); assertEquals(buy, stopper.shouldEnter(4)); } } |