@Override
    public boolean addAll(Collection<? extends E> c) {
        int numToAdd = c.size();
        if (underlying.size() > maxLength - numToAdd) {
            throw new BoundedListTooLongException("Cannot add another " + numToAdd +
                " element(s) to the list because it would exceed the maximum length of " +
                maxLength);
        }
        return underlying.addAll(c);
    }
@Test
    public void testAddAll() {
        BoundedList<String> list = BoundedList.newArrayBacked(5);
        list.add("a");
        list.add("b");
        list.add("c");
        assertEquals("Cannot add another 3 element(s) to the list because it would exceed the " +
            "maximum length of 5",
                assertThrows(BoundedListTooLongException.class,
                        () -> list.addAll(Arrays.asList("d", "e", "f"))).getMessage());
        assertEquals("Cannot add another 3 element(s) to the list because it would exceed the " +
            "maximum length of 5",
                assertThrows(BoundedListTooLongException.class,
                        () -> list.addAll(0, Arrays.asList("d", "e", "f"))).getMessage());
        list.addAll(Arrays.asList("d", "e"));
        assertEquals(Arrays.asList("a", "b", "c", "d", "e"), list);
    }