Question: Can someone help me write these LinkedStackTest in java. /** * This file will test the stack operations for the * LinkedStack. You must provide
Can someone help me write these LinkedStackTest in java.
/**
* This file will test the stack operations for the
* LinkedStack. You must provide all tests to verify
* correct operation of your stack.
*/
class LinkedStackTest {
// TODO: Declare some global stack instances to use in your tests.
// You must have multiple stacks, and they must have a variety
// of different data types: Integer, String, Double
@BeforeEach
void setUp() throws Exception {
// TODO: Construct the stacks here and fill your stacks with initial values
}
void testIsEmpty() {
// TODO: Test each stack
}
@Test
void testPush() {
// TODO: Make sure the push operation changes the top of each stack.
}
@Test
void testPop() {
// TODO: Assure correct behavior as all elements are popped off of each stack.
// Also check what happens when an empty stack is popped, using assertThrows.
}
@Test
void testClear() {
// TODO: Assure that stack is emptied as a result of clear command.
}
@Test
void testPeek() {
// TODO: Assure correct results from peek, as well as lack
// of modification to stack. Assure correct response when
// peeking on an empty stack as well.
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
