From 9b17ce170efc77e210c16030b268030873f9d659 Mon Sep 17 00:00:00 2001 From: MANISH-K-07 Date: Fri, 19 Apr 2024 13:50:57 +0100 Subject: [PATCH] Issue #14625: fix inspection violation OptionalGetWithoutIsPresent JavaParserTest tAHSLCN --- .../puppycrawl/tools/checkstyle/JavaParserTest.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/JavaParserTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/JavaParserTest.java index bb0686a5bd6..8a49b93b53b 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/JavaParserTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/JavaParserTest.java @@ -105,12 +105,6 @@ public void testAppendHiddenBlockCommentNodes() throws Exception { .isEqualTo(1); } - /** - * Temporary java doc. - * - * @noinspection OptionalGetWithoutIsPresent - * @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625 - */ @Test public void testAppendHiddenSingleLineCommentNodes() throws Exception { final DetailAST root = @@ -120,10 +114,10 @@ public void testAppendHiddenSingleLineCommentNodes() throws Exception { final Optional singleLineComment = TestUtil.findTokenInAstByPredicate(root, ast -> ast.getType() == TokenTypes.SINGLE_LINE_COMMENT); assertWithMessage("Single line comment should be present") - .that(singleLineComment.isPresent()) - .isTrue(); + .that(singleLineComment.isPresent()) + .isTrue(); - final DetailAST comment = singleLineComment.get(); + final DetailAST comment = singleLineComment.orElseThrow(); assertWithMessage("Unexpected line number") .that(comment.getLineNo())