class ForbiddenCallRule extends CobolCheck {

  @Override
  public void visitNode(AstNode callStatementNode) {
    AstNode calledProgramNode = callStatementNode.getFirstChild(getCobolGrammar().literal);
    if (calledProgramNode != null && calledProgramNode.getTokenValue().indexOf("FORBIDDEN") > -1) {
      reportIssue("CALL to this program are forbidden.").on(calledProgramNode);
    }
  }

}

class ForbiddenCallRuleTest {

  @Test
  public void testVisitNode() {

    ForbiddenCallRule check = new ForbiddenCallRule();
    CobolCheckVerifier.verify(
      new File("src/test/resources/checks/SRC/ForbiddenCall.cbl"),
      check);
  }

}