Select any tool that provides statement and decision code coverage. Utilizing the VendingMachine.java code Download VendingMachine.java codegiven to you, develop a set of test cases using JUnit for your code based on the following requirements: Takes in an integer input Allows users to select between three products: Candy (20 cents), Coke (25 cents), Coffee (45 cents) Returns the selected product and any remaining change If there is not enough money to buy the product, displays the amount necessary to buy the product and other products to purchase. Execute the program with your test cases and observe the code coverage of your test cases. The goal is to reach 100% in statement coverage and at least 90% decision coverage. For decision coverage, please make sure to test all the decisions except the False decision for line 32 (input < 45).
The VendingMachine.java code is provided here:
public class VendingMachine
{
public static String dispenseItem(int input, String item)
{
int cost = 0;
int change = 0;
String returnValue = "";
if (item == "candy")
cost = 20;
if (item == "coke")
cost = 25;
if (item == "coffee")
cost = 45;
if (input > cost)
{
change = input - cost;
returnValue = "Item dispensed and change of " +
Integer.toString(change) + " returned";
}
else if (input == cost)
{
change = 0;
returnValue = "Item dispensed.";
}
else
{
change = cost - input;
if(input < 45)
returnValue = "Item not dispensed, missing " +
Integer.toString(change) + " cents. Can purchase candy or coke.";
if(input < 25)
returnValue = "Item not dispensed, missing " +
Integer.toString(change) + " cents. Can purchase candy.";
if(input < 20)
returnValue = "Item not dispensed, missing " +
Integer.toString(change) + " cents. Cannot purchase item.";
}
return returnValue;
}
}