### Question:
RailsControllerParser implements EventBasedTokenizer { public static Collection<RailsController> parse(@Nonnull File rootFile) { if (!rootFile.exists() || !rootFile.isDirectory()) { LOG.error("Root file not found or is not directory. Exiting."); return null; } File ctrlDir = new File(rootFile,"app/controllers"); if (!ctrlDir.exists() || !ctrlDir.isDirectory()) { LOG.error("{rootFile}/app/controllers/ not found or is not directory. Exiting."); return null; } Collection<File> rubyFiles = FileUtils.listFiles(ctrlDir, new WildcardFileFilter("*_controller.rb"), TrueFileFilter.INSTANCE); RailsControllerParser parser = new RailsControllerParser(); parser.modelMap = RailsModelParser.parse(rootFile); parser.railsControllers = list(); for (File rubyFile : rubyFiles) { parser._continue = true; parser.tokenQueue = new ArrayDeque<String>(); parser.currentRailsController = null; parser.currentCtrlMethod = null; parser.currentParamName = null; parser.scopeTracker = new RubyScopeTracker(); parser.methodStartScopeDepth = -1; parser.currentCtrlState = ControllerState.INIT; parser.moduleNameStack.clear(); parser.currentParameterType = RouteParameterType.UNKNOWN; EventBasedTokenizerRunner.runRails(rubyFile, false, true, parser); if (parser.currentRailsController != null && parser.currentCtrlMethod != null && parser.currentCtrlMethod.getMethodName() != null) { parser.currentRailsController.addControllerMethod(parser.currentCtrlMethod); } if (parser.currentRailsController != null) { parser.currentRailsController.setControllerFile(rubyFile); parser.railsControllers.add(parser.currentRailsController); } } return parser.railsControllers; }  static Collection<RailsController> parse(@Nonnull File rootFile); @Override boolean shouldContinue(); @Override void processToken(int type, int lineNumber, String stringValue);  }### Answer:
@Test public void testRailsGoatControllerParser() { File f = new File(RAILSGOAT_SOURCE_LOCATION); assert(f.exists()); assert(f.isDirectory()); railsControllers = (List<RailsController>) RailsControllerParser.parse(f); checkControllers(RAILSGOAT_CONTROLLERS); checkController("Admin", RAILSGOAT_ADMIN_CONTROLLER); }