Hexagonal pattern: remove unnecessary repository usage from a unit test

This commit is contained in:
Ilkka Seppälä 2016-09-04 10:33:26 +03:00
parent ab68129829
commit 3cb872807e

View File

@ -49,20 +49,16 @@ import com.iluwatar.hexagonal.test.LotteryTestUtils;
public class LotteryTest { public class LotteryTest {
private final LotterySystem lotterySystem = new LotterySystemImpl(); private final LotterySystem lotterySystem = new LotterySystemImpl();
private final LotteryTicketRepository repository = new LotteryTicketInMemoryRepository();
private final WireTransfers wireTransfers = new WireTransfersImpl(); private final WireTransfers wireTransfers = new WireTransfersImpl();
@Before @Before
public void clear() { public void clear() {
repository.deleteAll(); // add funds to the test player's bank account
wireTransfers.setFunds("123-12312", 100);
} }
@Test @Test
public void testLottery() { public void testLottery() {
// setup bank account with funds
wireTransfers.setFunds("123-12312", 100);
// admin resets the lottery // admin resets the lottery
lotterySystem.resetLottery(); lotterySystem.resetLottery();
assertEquals(lotterySystem.getAllSubmittedTickets().size(), 0); assertEquals(lotterySystem.getAllSubmittedTickets().size(), 0);