2 * Copyright (c) 2016 Cisco Systems, Inc. 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.yangtools.yang2sources.plugin;
10 import static org.junit.Assert.assertNotNull;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.verify;
14 import org.apache.maven.model.Plugin;
15 import org.apache.maven.project.MavenProject;
16 import org.junit.Test;
17 import org.junit.runner.RunWith;
18 import org.mockito.Mock;
19 import org.mockito.Mockito;
20 import org.mockito.junit.MockitoJUnitRunner;
21 import org.sonatype.plexus.build.incremental.DefaultBuildContext;
23 @RunWith(MockitoJUnitRunner.class)
24 public class YangToSourcesMojoTest {
26 private MavenProject project;
28 private Plugin plugin;
31 public void yangToSourceMojoTest() throws Exception {
32 doReturn(plugin).when(project).getPlugin(YangToSourcesMojo.PLUGIN_NAME);
34 YangToSourcesMojo mojo = new YangToSourcesMojo();
35 mojo.setProject(project);
36 mojo.buildContext = new DefaultBuildContext();
40 final YangToSourcesProcessor processor = Mockito.mock(YangToSourcesProcessor.class);
41 mojo = new YangToSourcesMojo(processor);
42 mojo.setProject(project);
44 verify(processor).conditionalExecute(false);