### Question:
LogErrorValidator extends LogValidator<Log.error> { @Override public void validate(Method method, Log.error target) throws AnnotationUsageException { super.validate(method, target); Class<? extends Throwable>[] ofType = target.ofType(); Class<? extends Throwable>[] exclude = target.exclude(); ErrorLog.Filter filter = errorFilterFactory.buildErrorFilter(ofType, exclude); Set<Class<? extends Throwable>> includes = filter.getIncludes(); if (includes.isEmpty()) { throw new AnnotationUsageException(method, "Empty error set specified for filter", "Correct error sets or remove unnecessary annotation", target); } Set<Class<? extends Throwable>> excludes = filter.getExcludes(); if (ofType.length > includes.size() || exclude.length > excludes.size()) { throw new AnnotationUsageException(method, "Error set contains duplicates", "Remove duplicate error types", target); } } LogErrorValidator(PrinterResolver printerResolver); @Override void validate(Method method, Log.error target);  }### Answer:
@Test(expected = AnnotationUsageException.class) public void validateOfTypeEmpty() { PrinterResolver printerResolver = new AliasedPrinterResolver(emptyMap(), emptyMap()); LogErrorValidator logErrorValidator = new LogErrorValidator(printerResolver); Log.error logError = synthesizeAnnotation(singletonMap("ofType", new Class<?>[0]), Log.error.class, null); logErrorValidator.validate(method, logError); }
@Test(expected = AnnotationUsageException.class) public void validateOfTypeDuplicates() { PrinterResolver printerResolver = new AliasedPrinterResolver(emptyMap(), emptyMap()); LogErrorValidator logErrorValidator = new LogErrorValidator(printerResolver); Log.error logError = synthesizeAnnotation(singletonMap("ofType", new Class<?>[]{Throwable.class, Throwable.class}), Log.error.class, null); logErrorValidator.validate(method, logError); }
@Test(expected = AnnotationUsageException.class) public void validateExcludeDuplicates() { PrinterResolver printerResolver = new AliasedPrinterResolver(emptyMap(), emptyMap()); LogErrorValidator logErrorValidator = new LogErrorValidator(printerResolver); Log.error logError = synthesizeAnnotation(singletonMap("exclude", new Class<?>[]{Throwable.class, Throwable.class}), Log.error.class, null); logErrorValidator.validate(method, logError); }