예제 #1
0
  @Test
  public void shouldBuyTradeOnce() {
    Operation buy = new Operation(0, OperationType.BUY);

    assertTrue(strategy.shouldOperate(trade, 0));
    trade.operate(0);
    assertEquals(buy, trade.getEntry());
    assertFalse(strategy.shouldOperate(trade, 1));
    assertFalse(strategy.shouldOperate(trade, 6));
  }
예제 #2
0
  @Test
  public void sameIndexShouldResultSameAnswer() {
    Operation buy = new Operation(0, OperationType.BUY);

    assertTrue(strategy.shouldOperate(trade, 0));
    trade.operate(0);
    assertEquals(buy, trade.getEntry());
    Trade trade2 = new Trade();
    assertFalse(strategy.shouldOperate(trade2, 0));
    trade2.operate(0);
    assertEquals(buy, trade2.getEntry());
  }