-
Notifications
You must be signed in to change notification settings - Fork 13
/
FreeMarkerTest.java
40 lines (36 loc) · 1.77 KB
/
FreeMarkerTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package org.jboss.seam.rest.test.templating;
import static org.jboss.seam.rest.test.Dependencies.addJBossLoggingDependencyToManifest;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.seam.rest.test.Dependencies;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Ignore;
import org.junit.Test;
public class FreeMarkerTest extends AbstractTemplatingTest {
@Deployment(testable = false)
public static WebArchive createDeployment() {
WebArchive war = createTestApplication();
war.addAsLibraries(Dependencies.FREEMARKER);
war.addAsLibrary(getSeamRest());
addJBossLoggingDependencyToManifest(war); // SOLDER-119
return war;
}
@Test
public void testTemplate() throws Exception {
test("http://localhost:8080/test/freemarker/hello", 200, "Hello Jozef Hartinger", "text/student");
}
@Test
public void testExpressionLanguage() throws Exception {
String expectedResponse = "<university name=\"Masaryk University\"><students count=\"3\"><student>A</student><student>B</student><student>C</student><student>Jozef Hartinger</student></students></university>";
test("http://localhost:8080/test/freemarker/students", 200, expectedResponse, "application/university+xml");
}
@Test
public void testCorrectTemplateSelected() throws Exception {
test("http://localhost:8080/test/freemarker/greeting", 200, "Hi Jozef Hartinger", "text/greeting-informal");
test("http://localhost:8080/test/freemarker/greeting", 200, "Good morning Mr. Jozef Hartinger", "text/greeting-formal");
}
@Test
@Ignore
public void testString() throws Exception {
test("http://localhost:8080/test/freemarker/string", 200, "Hello Jozef!", "text/plain");
}
}