FixedStack implements IStack<T> { @Override public void push(T element) { stack[index] = element; index++; } @SuppressWarnings("unchecked")  FixedStack(int size); @Override void push(T element); @Override T peek(); @Override T pop(); @Override int size(); @Override boolean isEmpty(); @Override void clear(); @Override final T[] toArray(Class<T[]> arrayType);  }
@Test void push() { FixedStack<String> stack = new FixedStack<>(1); stack.push("element"); Assertions.assertEquals("element", stack.peek()); Assertions.assertEquals("element", stack.pop()); }