### Question:
Stack { public E set(int index, E value) { if (index >= mSize) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + mSize); } return mElements.set(index < 0 ? index + mSize : index, value); } Stack(); void push(E ele); E pop(); E peek(); E get(int index); E set(int index, E value); E remove(int index); int size(); boolean isEmpty(); void clear();  }### Answer:
@Test public void testIllegalSet() throws Exception { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { Stack<String> stack = new Stack<String>(); stack.set(1, "illegal"); }); }