### Question:
AnalyzerAdapter extends MethodVisitor { @Override public void visitFrame( final int type, final int numLocal, final Object[] local, final int numStack, final Object[] stack) { if (type != Opcodes.F_NEW) { throw new IllegalArgumentException( "AnalyzerAdapter only accepts expanded frames (see ClassReader.EXPAND_FRAMES)"); } super.visitFrame(type, numLocal, local, numStack, stack); if (this.locals != null) { this.locals.clear(); this.stack.clear(); } else { this.locals = new ArrayList<>(); this.stack = new ArrayList<>(); } visitFrameTypes(numLocal, local, this.locals); visitFrameTypes(numStack, stack, this.stack); maxLocals = Math.max(maxLocals, this.locals.size()); maxStack = Math.max(maxStack, this.stack.size()); } AnalyzerAdapter(
      final String owner,
      final int access,
      final String name,
      final String descriptor,
      final MethodVisitor methodVisitor); protected  AnalyzerAdapter(
      final int api,
      final String owner,
      final int access,
      final String name,
      final String descriptor,
      final MethodVisitor methodVisitor); @Override void visitFrame(
      final int type,
      final int numLocal,
      final Object[] local,
      final int numStack,
      final Object[] stack); @Override void visitInsn(final int opcode); @Override void visitIntInsn(final int opcode, final int operand); @Override void visitVarInsn(final int opcode, final int var); @Override void visitTypeInsn(final int opcode, final String type); @Override void visitFieldInsn(
      final int opcode, final String owner, final String name, final String descriptor); @Override void visitMethodInsn(
      final int opcodeAndSource,
      final String owner,
      final String name,
      final String descriptor,
      final boolean isInterface); @Override void visitInvokeDynamicInsn(
      final String name,
      final String descriptor,
      final Handle bootstrapMethodHandle,
      final Object... bootstrapMethodArguments); @Override void visitJumpInsn(final int opcode, final Label label); @Override void visitLabel(final Label label); @Override void visitLdcInsn(final Object value); @Override void visitIincInsn(final int var, final int increment); @Override void visitTableSwitchInsn(
      final int min, final int max, final Label dflt, final Label... labels); @Override void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Label[] labels); @Override void visitMultiANewArrayInsn(final String descriptor, final int numDimensions); @Override void visitLocalVariable(
      final String name,
      final String descriptor,
      final String signature,
      final Label start,
      final Label end,
      final int index); @Override void visitMaxs(final int maxStack, final int maxLocals); public List<Object> locals; public List<Object> stack; public Map<Object, Object> uninitializedTypes; }### Answer:
@Test public void testVisitFrame_emptyFrame() { AnalyzerAdapter analyzerAdapter = new AnalyzerAdapter("pkg/Class", Opcodes.ACC_PUBLIC, "name", "()V", null); Executable visitFrame = () -> analyzerAdapter.visitFrame(Opcodes.F_NEW, 0, null, 0, null); assertDoesNotThrow(visitFrame); }
@Test public void testVisitFrame_invalidFrameType() { AnalyzerAdapter analyzerAdapter = new AnalyzerAdapter("pkg/Class", Opcodes.ACC_PUBLIC, "name", "()V", null); Executable visitFrame = () -> analyzerAdapter.visitFrame(Opcodes.F_FULL, 0, null, 0, null); Exception exception = assertThrows(IllegalArgumentException.class, visitFrame); assertEquals( "AnalyzerAdapter only accepts expanded frames (see ClassReader.EXPAND_FRAMES)", exception.getMessage()); }