1 package com.atlassian.plugins.codegen.modules.common.moduletype;
2
3 import com.atlassian.plugins.codegen.AbstractCodegenTestCase;
4 import com.atlassian.plugins.codegen.AbstractModuleCreatorTestCase;
5 import com.atlassian.plugins.codegen.modules.PluginModuleLocation;
6
7 import org.junit.Before;
8 import org.junit.Test;
9
10 import static junit.framework.Assert.assertEquals;
11
12
13
14
15 public class ModuleTypeTest extends AbstractModuleCreatorTestCase<ModuleTypeProperties>
16 {
17 public static final String MODULE_TYPE = "module-type";
18
19 public ModuleTypeTest()
20 {
21 super("module-type", new ModuleTypeModuleCreator());
22 }
23
24 @Before
25 public void setupProps() throws Exception
26 {
27 setProps(new ModuleTypeProperties(PACKAGE_NAME + ".DictionaryModuleDescriptor"));
28 props.setFullyQualifiedInterface(PACKAGE_NAME + ".Dictionary");
29 props.setIncludeExamples(false);
30 }
31
32 @Test
33 public void classFileIsGenerated() throws Exception
34 {
35 getSourceFile(PACKAGE_NAME, "DictionaryModuleDescriptor");
36 }
37
38 @Test
39 public void interfaceFileIsGenerated() throws Exception
40 {
41 getSourceFile(PACKAGE_NAME, "Dictionary");
42 }
43
44 @Test
45 public void unitTestFileIsGenerated() throws Exception
46 {
47 getTestSourceFile(PACKAGE_NAME, "DictionaryModuleDescriptorTest");
48 }
49
50 @Test
51 public void functionalTestFileIsGenerated() throws Exception
52 {
53 getTestSourceFile(FUNC_TEST_PACKAGE_NAME, "DictionaryModuleDescriptorFuncTest");
54 }
55
56 @Test
57 public void moduleHasClass() throws Exception
58 {
59 assertEquals(PACKAGE_NAME + ".DictionaryModuleDescriptor",
60 getGeneratedModule().attributeValue("class"));
61 }
62
63 @Test
64 public void moduleHasDefaultKey() throws Exception
65 {
66 assertEquals("dictionary-module-descriptor",
67 getGeneratedModule().attributeValue("key"));
68 }
69 }