@Test public void processYangFileExitStackErrorExtraEntryTest() { thrown.expect(ParserException.class); thrown.expectMessage("Internal parser error detected: Invalid holder for yangbase after processing."); YangModule tmpModule = new YangModule(); YangModule tmpModule2 = new YangModule(); TreeWalkListener listener = new TreeWalkListener(); listener.getParsedDataStack().push(tmpModule); listener.getParsedDataStack().push(tmpModule2); GeneratedYangParser.YangfileContext ctx = null; BaseFileListener.processYangFileExit(listener, ctx); }
public static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx) { checkStackIsNotEmpty(listener, MISSING_HOLDER, YANGBASE_DATA, "", EXIT); if (listener.getParsedDataStack().peek() instanceof YangModule || listener.getParsedDataStack().peek() instanceof YangSubModule) { listener.setRootNode((YangNode) listener.getParsedDataStack().pop()); } else { throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, YANGBASE_DATA, "", EXIT)); } checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", EXIT); }
BaseFileListener { public static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx) { checkStackIsNotEmpty(listener, MISSING_HOLDER, YANGBASE_DATA, "", EXIT); if (listener.getParsedDataStack().peek() instanceof YangModule || listener.getParsedDataStack().peek() instanceof YangSubModule) { listener.setRootNode((YangNode) listener.getParsedDataStack().pop()); } else { throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, YANGBASE_DATA, "", EXIT)); } checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", EXIT); } }
BaseFileListener { public static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx) { checkStackIsNotEmpty(listener, MISSING_HOLDER, YANGBASE_DATA, "", EXIT); if (listener.getParsedDataStack().peek() instanceof YangModule || listener.getParsedDataStack().peek() instanceof YangSubModule) { listener.setRootNode((YangNode) listener.getParsedDataStack().pop()); } else { throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, YANGBASE_DATA, "", EXIT)); } checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", EXIT); } private  BaseFileListener(); }
BaseFileListener { public static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx) { checkStackIsNotEmpty(listener, MISSING_HOLDER, YANGBASE_DATA, "", EXIT); if (listener.getParsedDataStack().peek() instanceof YangModule || listener.getParsedDataStack().peek() instanceof YangSubModule) { listener.setRootNode((YangNode) listener.getParsedDataStack().pop()); } else { throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, YANGBASE_DATA, "", EXIT)); } checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", EXIT); } private  BaseFileListener(); static void processYangFileEntry(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx); static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx); }
BaseFileListener { public static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx) { checkStackIsNotEmpty(listener, MISSING_HOLDER, YANGBASE_DATA, "", EXIT); if (listener.getParsedDataStack().peek() instanceof YangModule || listener.getParsedDataStack().peek() instanceof YangSubModule) { listener.setRootNode((YangNode) listener.getParsedDataStack().pop()); } else { throw new ParserException(constructListenerErrorMessage(INVALID_CHILD, YANGBASE_DATA, "", EXIT)); } checkStackIsEmpty(listener, INVALID_HOLDER, YANGBASE_DATA, "", EXIT); } private  BaseFileListener(); static void processYangFileEntry(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx); static void processYangFileExit(TreeWalkListener listener, GeneratedYangParser.YangfileContext ctx);  }