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