1   package com.atlassian.plugins.codegen.modules.stash.ssh;
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 SshRequestHandlerTest extends AbstractModuleCreatorTestCase<SshScmRequestHandlerProperties>
10  {
11  
12      public SshRequestHandlerTest()
13      {
14          super("ssh-request-handler", new SshScmRequestHandlerModuleCreator());
15      }
16  
17      @Before
18      public void setupProps() throws Exception
19      {
20          setProps(new SshScmRequestHandlerProperties(PACKAGE_NAME + ".MySshRequest"));
21          props.setIncludeExamples(false);
22      }
23  
24      @Test
25      public void classFileIsGenerated() throws Exception
26      {
27          getSourceFile(PACKAGE_NAME, "MySshRequest");
28          getSourceFile(PACKAGE_NAME, "MySshRequestHandler");
29      }
30  
31      @Test
32      public void unitTestFileIsGenerated() throws Exception
33      {
34          getTestSourceFile(TEST_PACKAGE_NAME, "MySshRequestTest");
35          getTestSourceFile(TEST_PACKAGE_NAME, "MySshRequestHandlerTest");
36      }
37  
38      @Test
39      public void moduleHasDefaultKey() throws Exception
40      {
41          assertEquals("my-ssh-request-handler",
42                  getGeneratedModule().attributeValue("key"));
43      }
44  
45      @Test
46      public void moduleHasClass() throws Exception
47      {
48          assertEquals(PACKAGE_NAME + ".MySshRequestHandler",
49                  getGeneratedModule().attributeValue("class"));
50      }
51  
52  
53  }