steveloughran commented on code in PR #6557: URL: https://github.com/apache/hadoop/pull/6557#discussion_r1553455963
########## hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java: ########## @@ -509,61 +508,6 @@ public static <T, E extends Throwable> E intercept( return ex; } - /** - * Intercept an exception; throw an {@code AssertionError} if one not raised. - * The caught exception is rethrown if it is of the wrong class or - * does not contain the text defined in {@code contained}. - * <p> - * Example: expect deleting a nonexistent file to raise a - * {@code FileNotFoundException} with the {@code toString()} value - * containing the text {@code "missing"}. - * <pre> - * FileNotFoundException ioe = intercept(FileNotFoundException.class, - * "missing", - * "path should not be found", - * () -> { - * filesystem.delete(new Path("/missing"), false); - * }); - * </pre> - * - * @param clazz class of exception; the raised exception must be this class - * <i>or a subclass</i>. - * @param contains strings which must be in the {@code toString()} value - * of the exception (order does not matter) - * @param message any message tho include in exception/log messages - * @param eval expression to eval - * @param <T> return type of expression - * @param <E> exception class - * @return the caught exception if it was of the expected type and contents - * @throws Exception any other exception raised - * @throws AssertionError if the evaluation call didn't raise an exception. - * The error includes the {@code toString()} value of the result, if this - * can be determined. - * @see GenericTestUtils#assertExceptionContains(String, Throwable) - */ - public static <T, E extends Throwable> E intercept( Review Comment: I do think this is a good feature, it's just we need to give it a name which doesn't run any risk of causing compilation problems. alternatively, in `GenericTestUtils` add a new method `assertExceptionContainsAllStrings()` taking a varargs list of strings. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org