2 * Copyright (c) 2016 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin;
10 import static org.junit.Assert.assertEquals;
11 import com.github.javaparser.ast.PackageDeclaration;
12 import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
13 import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
14 import com.google.common.base.Preconditions;
16 abstract class AbstractVerifier extends VoidVisitorAdapter<Void> {
17 private final String expectedPackageName;
18 private final String expectedType;
19 private String packageName;
22 AbstractVerifier(final String expectedPackageName, final String fileName) {
23 this.expectedPackageName = Preconditions.checkNotNull(expectedPackageName);
24 this.expectedType = fileName.substring(0, fileName.length() - 5);
28 public void visit(final ClassOrInterfaceDeclaration n, final Void arg) {
34 public final void visit(final PackageDeclaration n, final Void arg) {
35 packageName = n.getName().toString();
40 assertEquals(expectedPackageName, packageName);
41 assertEquals(expectedType, type);