1   package com.atlassian.plugins.codegen.modules.common.servlet;
2   
3   import java.io.IOException;
4   
5   import com.atlassian.plugins.codegen.AbstractCodegenTestCase;
6   import com.atlassian.plugins.codegen.modules.PluginModuleLocation;
7   
8   import org.apache.commons.io.FileUtils;
9   import org.junit.Before;
10  import org.junit.Test;
11  
12  import static org.junit.Assert.assertTrue;
13  //TODO: update test to use Dom4J
14  
15  /**
16   * @since 3.6
17   */
18  public class ServletContextParameterTest extends AbstractCodegenTestCase<ServletContextParameterProperties>
19  {
20  
21      @Before
22      public void runGenerator() throws Exception
23      {
24          setCreator(new ServletContextParameterModuleCreator());
25          setModuleLocation(new PluginModuleLocation.Builder(srcDir)
26                  .resourcesDirectory(resourcesDir)
27                  .testDirectory(testDir)
28                  .templateDirectory(templateDir)
29                  .build());
30  
31          setProps(new ServletContextParameterProperties("MY Param Name"));
32  
33          creator.createModule(moduleLocation, props);
34      }
35  
36      @Test
37      public void pluginXmlContainsModule() throws IOException
38      {
39          String pluginXmlContent = FileUtils.readFileToString(pluginXml);
40  
41          assertTrue("module not found in plugin xml", pluginXmlContent.contains("<servlet-context-param"));
42      }
43  
44  }