### Question:
CheckRecordComponentAdapter extends RecordComponentVisitor { @Override public void visitAttribute(final Attribute attribute) { checkVisitEndNotCalled(); if (attribute == null) { throw new IllegalArgumentException("Invalid attribute (must not be null)"); } super.visitAttribute(attribute); } CheckRecordComponentAdapter(final RecordComponentVisitor recordComponentVisitor); protected  CheckRecordComponentAdapter(
      final int api, final RecordComponentVisitor recordComponentVisitor); @Override AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible); @Override AnnotationVisitor visitTypeAnnotation(
      final int typeRef, final TypePath typePath, final String descriptor, final boolean visible); @Override void visitAttribute(final Attribute attribute); @Override void visitEnd();  }### Answer:
@Test public void testVisitAttribute_illegalAttribute() { CheckRecordComponentAdapter checkRecordComponentAdapter = new CheckRecordComponentAdapter(null); Executable visitAttribute = () -> checkRecordComponentAdapter.visitAttribute(null); Exception exception = assertThrows(IllegalArgumentException.class, visitAttribute); assertEquals("Invalid attribute (must not be null)", exception.getMessage()); }