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

5. Write unit testing code for the following MyStack class using JUnit5 Framework. Make [15] 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 = 0; } boolean isFull() { if(top==SIZE) return true; return false; } boolean isEmpty() { if(top==0) return true; return false; } void push(int key) { if(isFull()) System.out.println("Stack Full."); else items[top++] = key; } void pop() { Page 3 of 4 13 January 2021 if(isEmpty()) System.out.println("Stack Empty."); else 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
