// Test case 5 : Inserting more then 50 cents and checking for change and Gumball in slot @Test public void testFiftyPlusSecond() { gumballM1.insertDime(); gumballM1.insertDime(); gumballM1.insertDime(); gumballM1.insertQuarter(); gumballM1.turnCrank(); assertEquals(true, gumballM1.isGumballInSlot()); }
// Test Case 9: Insert 50 cents first but remove some amount before // turning crank then check to see if gumball is dispenced or not : -ve test case @Test public void TestQDDDDEjectQNegative() { gumballM1.insertQuarter(); gumballM1.insertDime(); gumballM1.insertDime(); gumballM1.insertDime(); gumballM1.ejectQuarter(); gumballM1.turnCrank(); assertEquals(false, gumballM1.isGumballInSlot()); }
// Test case 1: insert 1 quarter, insert 1 dime and 3 nickel = 50Cents : +ve test case @Test public void testQDNNNHappy() { gumballM1.insertQuarter(); gumballM1.insertDime(); gumballM1.insertNickel(); gumballM1.insertNickel(); gumballM1.insertNickel(); gumballM1.turnCrank(); assertEquals(true, gumballM1.isGumballInSlot()); }
// 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()); }
// Test case 8 : Testing eject method and get cents back method @Test public void testEjectAndCentsBackCheck() { gumballM1.insertQuarter(); gumballM1.ejectNickel(); gumballM1.insertDime(); gumballM1.insertDime(); gumballM1.insertQuarter(); // assertEquals(15, gumballM1.getChange()); assertEquals(false, gumballM1.isGumballInSlot()); gumballM1.turnCrank(); assertEquals(true, gumballM1.isGumballInSlot()); }