Advertisement
duc-phan

Untitled

Dec 23rd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. public interface StockExchange {
  2.     Money currentPrice(String symbol);
  3. }
  4.  
  5. public class PortfolioTest {
  6.     private FixedStockExchangeStub exchange;
  7.     private Portfolio portfolio;
  8.     @Before
  9.     protected void setUp() throws Exception {
  10.         exchange = new FixedStockExchangeStub();
  11.         exchange.fix("MSFT", 100);
  12.         portfolio = new Portfolio(exchange);
  13.     }
  14.     @Test
  15.     public void GivenFiveMSFTTotalShouldBe500() throws Exception {
  16.         portfolio.add(5, "MSFT");
  17.         Assert.assertEquals(500, portfolio.value());
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement