### Question:
CheckAnnotationAdapter extends AnnotationVisitor { @Override public void visit(final String name, final Object value) { checkVisitEndNotCalled(); checkName(name); if (!(value instanceof Byte || value instanceof Boolean || value instanceof Character || value instanceof Short || value instanceof Integer || value instanceof Long || value instanceof Float || value instanceof Double || value instanceof String || value instanceof Type || value instanceof byte[] || value instanceof boolean[] || value instanceof char[] || value instanceof short[] || value instanceof int[] || value instanceof long[] || value instanceof float[] || value instanceof double[])) { throw new IllegalArgumentException("Invalid annotation value"); } if (value instanceof Type && ((Type) value).getSort() == Type.METHOD) { throw new IllegalArgumentException("Invalid annotation value"); } super.visit(name, value); } CheckAnnotationAdapter(final AnnotationVisitor annotationVisitor);   CheckAnnotationAdapter(final AnnotationVisitor annotationVisitor, final boolean useNamedValues); @Override void visit(final String name, final Object value); @Override void visitEnum(final String name, final String descriptor, final String value); @Override AnnotationVisitor visitAnnotation(final String name, final String descriptor); @Override AnnotationVisitor visitArray(final String name); @Override void visitEnd();  }### Answer:
@Test public void testVisit_illegalAnnotationName() { CheckAnnotationAdapter checkAnnotationAdapter = new CheckAnnotationAdapter(null); Executable visit = () -> checkAnnotationAdapter.visit(null, Integer.valueOf(0)); Exception exception = assertThrows(IllegalArgumentException.class, visit); assertEquals("Annotation value name must not be null", exception.getMessage()); }
@Test public void testVisit_illegalAnnotationValue1() { CheckAnnotationAdapter checkAnnotationAdapter = new CheckAnnotationAdapter(null); Executable visit = () -> checkAnnotationAdapter.visit("name", new Object()); Exception exception = assertThrows(IllegalArgumentException.class, visit); assertEquals("Invalid annotation value", exception.getMessage()); }
@Test public void testVisit_illegalAnnotationValue2() { CheckAnnotationAdapter checkAnnotationAdapter = new CheckAnnotationAdapter(null); Executable visit = () -> checkAnnotationAdapter.visit("name", Type.getMethodType("()V")); Exception exception = assertThrows(IllegalArgumentException.class, visit); assertEquals("Invalid annotation value", exception.getMessage()); }