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
12
13 public class WorkflowConditionTest extends AbstractModuleCreatorTestCase<WorkflowElementProperties>
14 {
15 public WorkflowConditionTest()
16 {
17 super("workflow-condition", new WorkflowConditionModuleCreator());
18 }
19
20 @Before
21 public void setupProps() throws Exception
22 {
23 setProps(new WorkflowElementProperties(PACKAGE_NAME + ".MyWorkflowCondition"));
24 props.setIncludeExamples(false);
25 }
26
27 @Test
28 public void classFileIsGenerated() throws Exception
29 {
30 getSourceFile(PACKAGE_NAME, "MyWorkflowCondition");
31 }
32
33 @Test
34 public void factoryClassFileIsGenerated() throws Exception
35 {
36 getSourceFile(PACKAGE_NAME, "MyWorkflowConditionFactory");
37 }
38
39 @Test
40 public void unitTestFileIsGenerated() throws Exception
41 {
42 getTestSourceFile(PACKAGE_NAME, "MyWorkflowConditionTest");
43 }
44
45 @Test
46 public void viewTemplateIsGenerated() throws Exception
47 {
48 getResourceFile("templates/conditions", "my-workflow-condition.vm");
49 }
50
51 @Test
52 public void inputTemplateIsGenerated() throws Exception
53 {
54 getResourceFile("templates/conditions", "my-workflow-condition-input.vm");
55 }
56
57 @Test
58 public void moduleHasDefaultKey() throws Exception
59 {
60 assertEquals("my-workflow-condition",
61 getGeneratedModule().attributeValue("key"));
62 }
63
64 @Test
65 public void moduleHasClass() throws Exception
66 {
67 assertEquals(PACKAGE_NAME + ".MyWorkflowConditionFactory",
68 getGeneratedModule().attributeValue("class"));
69 }
70
71 @Test
72 public void moduleHasConditionClass() throws Exception
73 {
74 assertEquals(PACKAGE_NAME + ".MyWorkflowCondition", getGeneratedModule().selectSingleNode("condition-class").getText());
75 }
76 }