1   package com.atlassian.plugins.codegen.modules.jira;
2   
3   import com.atlassian.plugins.codegen.AbstractModuleCreatorTestCase;
4   
5   import org.junit.Before;
6   import org.junit.Test;
7   
8   import static junit.framework.Assert.assertEquals;
9   
10  /**
11   * @since 3.6
12   */
13  public class JqlFunctionTest extends AbstractModuleCreatorTestCase<JqlFunctionProperties>
14  {
15      public JqlFunctionTest()
16      {
17          super("jql-function", new JqlFunctionModuleCreator());
18      }
19  
20      @Before
21      public void setupProps() throws Exception
22      {
23          setProps(new JqlFunctionProperties(PACKAGE_NAME + ".MyJqlFunction"));
24          props.setIncludeExamples(false);
25      }
26  
27      @Test
28      public void classFileIsGenerated() throws Exception
29      {
30          getSourceFile(PACKAGE_NAME, "MyJqlFunction");
31      }
32  
33      @Test
34      public void unitTestFileIsGenerated() throws Exception
35      {
36          getTestSourceFile(PACKAGE_NAME, "MyJqlFunctionTest");
37      }
38      
39      @Test
40      public void moduleHasDefaultKey() throws Exception
41      {
42          assertEquals("my-jql-function",
43                       getGeneratedModule().attributeValue("key"));
44      }
45      
46      @Test
47      public void moduleHasClass() throws Exception
48      {
49          assertEquals(PACKAGE_NAME + ".MyJqlFunction",
50                       getGeneratedModule().attributeValue("class"));
51      }
52  }