### Question:
CheckClassAdapter extends ClassVisitor { @Override public void visitSource(final String file, final String debug) { checkState(); if (visitSourceCalled) { throw new IllegalStateException("visitSource can be called only once."); } visitSourceCalled = true; super.visitSource(file, debug); } CheckClassAdapter(final ClassVisitor classVisitor);  CheckClassAdapter(final ClassVisitor classVisitor, final boolean checkDataFlow); protected  CheckClassAdapter(
      final int api, final ClassVisitor classVisitor, final boolean checkDataFlow); @Override void visit(
      final int version,
      final int access,
      final String name,
      final String signature,
      final String superName,
      final String[] interfaces); @Override void visitSource(final String file, final String debug); @Override ModuleVisitor visitModule(final String name, final int access, final String version); @Override void visitNestHost(final String nestHost); @Override void visitNestMember(final String nestMember); @Override void visitPermittedSubclass(final String permittedSubclass); @Override void visitOuterClass(final String owner, final String name, final String descriptor); @Override void visitInnerClass(
      final String name, final String outerName, final String innerName, final int access); @Override RecordComponentVisitor visitRecordComponent(
      final String name, final String descriptor, final String signature); @Override FieldVisitor visitField(
      final int access,
      final String name,
      final String descriptor,
      final String signature,
      final Object value); @Override MethodVisitor visitMethod(
      final int access,
      final String name,
      final String descriptor,
      final String signature,
      final String[] exceptions); @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(); static void checkClassSignature(final String signature); static void checkMethodSignature(final String signature); static void checkFieldSignature(final String signature); static void main(final String[] args); static void verify(
      final ClassReader classReader, final boolean printResults, final PrintWriter printWriter); static void verify(
      final ClassReader classReader,
      final ClassLoader loader,
      final boolean printResults,
      final PrintWriter printWriter);  }### Answer:
@Test public void testVisitSource_beforeStart() { CheckClassAdapter checkClassAdapter = new CheckClassAdapter(null); Executable visitSource = () -> checkClassAdapter.visitSource(null, null); Exception exception = assertThrows(IllegalStateException.class, visitSource); assertEquals("Cannot visit member before visit has been called.", exception.getMessage()); }