private void checkUnmodifiable(String desc, Collection collection) {
        String testVal = "xyz";

        // Check can't add()
        try {
            collection.add(testVal);
            fail(desc + ".add()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't addAll()
        List list = new ArrayList(1);
        list.add(testVal);
        try {
            collection.addAll(list);
            fail(desc + ".addAll()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't clear()
        try {
            collection.clear();
            fail(desc + ".clear()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't remove()
        try {
            collection.remove("abc");
            fail(desc + ".remove()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't removeAll()
        try {
            collection.removeAll(list);
            fail(desc + ".removeAll()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }

        // Check can't retainAll()
        try {
            collection.retainAll(list);
            fail(desc + ".retainAll()");
        } catch(UnsupportedOperationException ignore) {
            // expected result
        }
    }