View Javadoc
1   /*
2    * Copyright 2013 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * You may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.codehaus.gmavenplus.mojo;
18  
19  import org.junit.Before;
20  import org.junit.Test;
21  import org.mockito.Mock;
22  import org.mockito.MockitoAnnotations;
23  
24  import java.io.File;
25  
26  import static org.junit.Assert.assertEquals;
27  import static org.mockito.Mockito.doReturn;
28  
29  
30  /**
31   * Unit tests for the AbstractGroovyStubSourcesMojo class.
32   *
33   * @author Keegan Witt
34   */
35  public class AbstractGroovyStubSourcesMojoTest {
36      private TestMojo testMojo;
37      @Mock
38      private File outputDirectory;
39      private static final String PATH = "path";
40  
41      @Before
42      public void setup() {
43          MockitoAnnotations.openMocks(this);
44          testMojo = new TestMojo();
45          doReturn(PATH).when(outputDirectory).getAbsolutePath();
46      }
47  
48      @Test
49      public void testGetStubsEmpty() {
50          assertEquals(0, testMojo.getStubs(outputDirectory).size());
51      }
52  
53      protected static class TestMojo extends AbstractGroovyStubSourcesMojo {
54          @Override
55          public void execute() {
56          }
57      }
58  
59  }