IssuableSubscriptionVisitor extends SubscriptionVisitor { @Override protected void scanTree(Tree tree) { throw new UnsupportedOperationException("IssuableSubscriptionVisitor should not drive visit of AST."); }  void addIssue(int line, String message); void addIssueOnFile(String message); void reportIssue(Tree tree, String message); void reportIssue(Tree tree, String message, List<JavaFileScannerContext.Location> flow, @Nullable Integer cost); void reportIssue(Tree startTree, Tree endTree, String message);  }
@Test void check_issuable_subscription_visitor_does_not_visit_tree_on_its_own() { CompilationUnitTree tree = Mockito.mock(CompilationUnitTree.class); CustomRule visitor = new CustomRule(); try { visitor.scanTree(tree); fail("Analysis should have failed"); } catch (UnsupportedOperationException e) { assertThat(e).hasMessage("IssuableSubscriptionVisitor should not drive visit of AST."); } }