Activities to Celebrate your Independence
- Implement a JUnit test class for the
PureStack
interface with a @BeforeEach
method that creates a Stack
object. You may wish to reference the ListTest
class as a model.
- Implement a
@Test
method for push(E)
method.
- Implement a
@Test
method for isEmpty()
method.
- Implement a
@Test
method for peek()
method.
- Implement a
@Test
method for pop()
method.
- Implement a
LinkedStack<E>
class that implements the PureStack
interface. The class must have a single attribute: Node<E> top
that points to the top of the stack. The Node<E>
class should have two attributes: E value
and Node<E> next
.
- Modify the test class to test your
LinkedStack<E>
implementation.