1   package com.atlassian.plugins.codegen.modules.common.web;
2   
3   import org.junit.Before;
4   import org.junit.Test;
5   
6   import static org.junit.Assert.assertEquals;
7   
8   /**
9    * @since 3.6
10   */
11  public class WebPanelTest extends AbstractWebFragmentTest<WebPanelProperties>
12  {
13      public static final String CUSTOM_LOCATION = "system.admin/mysection";
14  
15      public WebPanelTest()
16      {
17          super("web-panel", new WebPanelModuleCreator());
18      }
19      
20      @Before
21      public void setupProps() throws Exception
22      {
23          setProps(new WebPanelProperties(MODULE_NAME, CUSTOM_LOCATION));
24          props.setIncludeExamples(false);
25      }
26  
27      @Test
28      public void moduleHasDefaultKey() throws Exception
29      {
30          assertEquals(MODULE_KEY, getGeneratedModule().attributeValue("key"));
31      }
32  
33      @Test
34      public void moduleHasLocation() throws Exception
35      {
36          assertEquals(CUSTOM_LOCATION, getGeneratedModule().attributeValue("location"));
37      }
38      
39      @Test
40      public void moduleHasDefaultWeight() throws Exception
41      {
42          assertEquals("1000", getGeneratedModule().attributeValue("weight"));
43      }
44  
45      @Test
46      public void moduleHasSpecifiedWeight() throws Exception
47      {
48          props.setWeight(20);
49  
50          assertEquals("20", getGeneratedModule().attributeValue("weight"));
51      }
52  }