### Question:
ObjectStack { public Object pop() { Object returnValue = peek(); int lastIndex = collection.size() - 1; collection.remove(lastIndex); return returnValue; } ObjectStack(); boolean isEmpty(); int size(); void push(Object value); Object pop(); Object peek(); void clear();  }### Answer:
@Test void testPopWithEmptyStack() { assertThrows(EmptyStackException.class, () -> createStackWithNElements(0).pop()); }
@Test void testPopWithNonEmptyStack() { ObjectStack stack = createStackWithNElements(5); for (int value = 4; value >= 0; --value) { assertEquals(value, stack.pop()); } assertThrows(EmptyStackException.class, () -> stack.pop()); }