FixedStack implements IStack<T> { @Override public boolean isEmpty() { return index == 0; } @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 isEmpty() { FixedStack<String> stack = new FixedStack<>(1); Assertions.assertTrue(stack.isEmpty()); stack.push("element"); Assertions.assertFalse(stack.isEmpty()); }