Question: 5. Write unit testing code for the following MyStack class using JUnits Framework. Make sure all the methods are tested and the timeouts of all

5. Write unit testing code for the following MyStack class using JUnits Framework. Make sure all the methods are tested and the timeouts of all methods' call are at most 100 milliseconds. public class MyStack { private int SIZE; private int items[]; private int top; public Mystack(int size) { SIZE - size; items - new int [SIZE]; top - ; > boolean isFull() { if(top--SIZE) return true; return false; ) boolean isEmpty() { if(top-e) return true; return false; else void push(int key) { if(isFull()) System.out.println("Stack Full."); items[top++] = key; > void pop() { Page 3 of 4 13 January else if(isempty()) System.out.println("Stack Empty."); top--; > int peek() { return items(top-1]; } } // Mystack class ends
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
