コード例 #1
0
 // Test case 6 : Insert 2 quarters and turn crank and Insert 2 quarters again and turn crank
 // Chenking to see if multiple time inserting 50 cents dispences the gumball
 @Test
 public void testCountOfGumballsInSlot() {
   gumballM1.insertQuarter();
   gumballM1.insertQuarter();
   gumballM1.turnCrank();
   gumballM1.insertQuarter();
   gumballM1.insertQuarter();
   gumballM1.turnCrank();
   assertEquals(true, gumballM1.isGumballInSlot());
   gumballM1.takeGumballFromSlot();
   assertEquals(false, gumballM1.isGumballInSlot());
 }
コード例 #2
0
 // Test case 4 :Try to take a dispensed gumball and crank the machine again without inserting any
 // coin
 @Test
 public void testTakeGumballAndCrankAgainWithoutInsertingAnyCoinQDNNN() {
   gumballM1.insertQuarter();
   gumballM1.insertDime();
   gumballM1.insertNickel();
   gumballM1.insertNickel();
   gumballM1.insertNickel();
   gumballM1.turnCrank();
   gumballM1.takeGumballFromSlot();
   soldState.turnCrank();
   assertEquals(false, gumballM1.isGumballInSlot());
 }