### Question:
CheckSignatureAdapter extends SignatureVisitor { @Override public SignatureVisitor visitSuperclass() { if (type != CLASS_SIGNATURE || !VISIT_SUPER_CLASS_STATES.contains(state)) { throw new IllegalStateException(); } state = State.SUPER; return new CheckSignatureAdapter( TYPE_SIGNATURE, signatureVisitor == null ? null : signatureVisitor.visitSuperclass()); } CheckSignatureAdapter(final int type, final SignatureVisitor signatureVisitor); protected  CheckSignatureAdapter(
      final int api, final int type, final SignatureVisitor signatureVisitor); @Override void visitFormalTypeParameter(final String name); @Override SignatureVisitor visitClassBound(); @Override SignatureVisitor visitInterfaceBound(); @Override SignatureVisitor visitSuperclass(); @Override SignatureVisitor visitInterface(); @Override SignatureVisitor visitParameterType(); @Override SignatureVisitor visitReturnType(); @Override SignatureVisitor visitExceptionType(); @Override void visitBaseType(final char descriptor); @Override void visitTypeVariable(final String name); @Override SignatureVisitor visitArrayType(); @Override void visitClassType(final String name); @Override void visitInnerClassType(final String name); @Override void visitTypeArgument(); @Override SignatureVisitor visitTypeArgument(final char wildcard); @Override void visitEnd(); static final int CLASS_SIGNATURE; static final int METHOD_SIGNATURE; static final int TYPE_SIGNATURE; }### Answer:
@Test public void testVisitSuperClass_classSignature_illegalState() { CheckSignatureAdapter checkSignatureAdapter = new CheckSignatureAdapter(CheckSignatureAdapter.CLASS_SIGNATURE, null); checkSignatureAdapter.visitSuperclass(); Executable visitSuperClass = () -> checkSignatureAdapter.visitSuperclass(); assertThrows(IllegalStateException.class, visitSuperClass); }
@Test public void testVisitSuperClass_methodSignature_illegalState() { CheckSignatureAdapter checkSignatureAdapter = new CheckSignatureAdapter(CheckSignatureAdapter.METHOD_SIGNATURE, null); Executable visitSuperClass = () -> checkSignatureAdapter.visitSuperclass(); assertThrows(IllegalStateException.class, visitSuperClass); }