1   package org.apache.maven.plugins.help;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.execution.MavenSession;
23  import org.apache.maven.plugin.testing.AbstractMojoTestCase;
24  
25  import java.io.File;
26  import java.util.Arrays;
27  import java.util.Calendar;
28  import java.util.Properties;
29  
30  /**
31   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
32   * @version $Id: HelpUtilTest.java 925956 2010-03-22 05:21:41Z brett $
33   *
34   */
35  public class HelpUtilTest
36      extends AbstractMojoTestCase
37  {
38      /**
39       * Test method for {@link org.apache.maven.plugins.help.HelpUtil#getMojoDescriptor(java.lang.String, org.apache.maven.execution.MavenSession, org.apache.maven.project.MavenProject,
40       * java.lang.String, boolean, boolean)}.
41       *
42       * @throws Exception if any
43       */
44      public void testGetMojoDescriptor()
45          throws Exception
46      {
47          File testPom =
48              new File( getBasedir(),
49                        "src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml" );
50          EvaluateMojo describe = (EvaluateMojo) lookupMojo( "evaluate", testPom );
51  
52          MavenSession session =
53              new MavenSession(
54                                container,
55                                describe.settings, // Settings settings,
56                                describe.localRepository, // ArtifactRepository localRepository,
57                                null, // EventDispatcher eventDispatcher,
58                                null, // ReactorManager reactorManager,
59                                Arrays.asList( new String[] { "evaluate" } ),
60                                describe.project.getBasedir().toString(), new Properties(),
61                                Calendar.getInstance().getTime() );
62          HelpUtil.getMojoDescriptor( "help:evaluate", session, describe.project, "help:evaluate", true, false );
63      }
64  }