View Javadoc
1   package org.codehaus.gmavenplus.mojo;
2   
3   import org.junit.Before;
4   import org.junit.Test;
5   import org.mockito.Mock;
6   import org.mockito.MockitoAnnotations;
7   
8   import java.io.File;
9   
10  import static org.junit.Assert.assertEquals;
11  import static org.mockito.Mockito.doReturn;
12  
13  
14  /**
15   * Unit tests for the AbstractGroovyStubSourcesMojo class.
16   *
17   * @author Keegan Witt
18   */
19  public class AbstractGroovyStubSourcesMojoTest {
20      private TestMojo testMojo;
21      @Mock
22      private File outputDirectory;
23      private static final String PATH = "path";
24  
25      @Before
26      public void setup() {
27          MockitoAnnotations.openMocks(this);
28          testMojo = new TestMojo();
29          doReturn(PATH).when(outputDirectory).getAbsolutePath();
30      }
31  
32      @Test
33      public void testGetStubsEmpty() {
34          assertEquals(0, testMojo.getStubs(outputDirectory).size());
35      }
36  
37      protected static class TestMojo extends AbstractGroovyStubSourcesMojo {
38          @Override
39          public void execute() {
40          }
41      }
42  
43  }