1 package com.atlassian.plugin.webresource;
2
3 import junit.framework.TestCase;
4
5 import java.util.HashMap;
6
7 public class TestJavascriptWebResourceFormatter extends TestCase
8 {
9 private JavascriptWebResourceFormatter javascriptWebResourceFormatter;
10
11 protected void setUp() throws Exception
12 {
13 super.setUp();
14 javascriptWebResourceFormatter = new JavascriptWebResourceFormatter();
15 }
16
17 protected void tearDown() throws Exception
18 {
19 javascriptWebResourceFormatter = null;
20 super.tearDown();
21 }
22
23 public void testMatches()
24 {
25 assertTrue(javascriptWebResourceFormatter.matches("blah.js"));
26 assertFalse(javascriptWebResourceFormatter.matches("blah.css"));
27 }
28
29 public void testFormatResource()
30 {
31 final String url = "/confluence/download/resources/confluence.web.resources:ajs/atlassian.js";
32 assertEquals("<script type=\"text/javascript\" src=\"" + url + "\" ></script>\n",
33 javascriptWebResourceFormatter.formatResource(url, new HashMap()));
34 }
35 }