/plugin-module-codegen-engine/src/test/java/com/atlassian/plugins/codegen/modules/jira/WorkflowValidatorTest.java

https://bitbucket.org/mmeinhold/amps · Java · 64 lines · 50 code · 11 blank · 3 comment · 0 complexity · e3fb87186edb877c341150fab646fdbf MD5 · raw file

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