Question: Write a test class for the following . Please use assert while testing the methods. LinkedStack.java import java.util.*; import stack.*; import java.util.EmptyStackException; import java.util.Random; import
Write a test class for the following . Please use assert while testing the methods.
LinkedStack.java
import java.util.*;
import stack.*;
import java.util.EmptyStackException; import java.util.Random;
import java.awt.Color; import java.math.*; public class LinkedStack
private int size=0; private Node
public void clear() { // TODO Auto-generated method stub this.topNode=null; this.size=0; }
public boolean isEmpty() { if (this.size()==0){ return true; } return false; } public String toString(){ super.toString(); Node
public T peek() { if(this.size<=0){ throw new EmptyStackException(); } return this.topNode.getData(); }
public T pop() { if(size<=0){ throw new EmptyStackException(); } Node
public void push(T arg0) { Node
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
