Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
First working Jersey/REST API test
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Kleppmann committed Jun 12, 2009
1 parent 879a378 commit 1881cc0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .classpath
Expand Up @@ -4,6 +4,7 @@
<classpathentry kind="src" output="target/webapp" path="src/main/webapp"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/scala"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="var" path="M2_REPO/asm/asm/3.1/asm-3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/jteigen/scalatest/junit4runner/1.0-SNAPSHOT/junit4runner-1.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/com/sun/grizzly/grizzly-framework/1.9.8/grizzly-framework-1.9.8.jar"/>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -154,6 +154,7 @@
<include>**/*TestCase.class</include>
<include>**/*Spec.class</include>
</includes>
<argLine>-Djava.endorsed.dirs=${settings.localRepository}/javax/xml/bind/jaxb-api/2.1 -Dneo4j.config=src/main/webapp/WEB-INF/neo4j.properties</argLine>
</configuration>
</plugin>
</plugins>
Expand Down
22 changes: 22 additions & 0 deletions src/test/java/com/example/restapi/NeoResourceTest.java
@@ -0,0 +1,22 @@
package com.example.restapi;

import com.sun.jersey.test.framework.JerseyTest;
import org.junit.*;
import static org.junit.Assert.*;

/**
* Sadly, we cannot yet write Jersey client tests in Scala because of a bug in the compiler:
* http://lampsvn.epfl.ch/trac/scala/ticket/1539
*/
public class NeoResourceTest extends JerseyTest {

public NeoResourceTest() throws Exception {
super("com.example.restapi");
}

@Test
public void testHelloWorld() {
String response = webResource.path("/neo_resource/0").get(String.class);
assertEquals("{\"_id\":0,\"_out\":{},\"_in\":{}}", response);
}
}

0 comments on commit 1881cc0

Please sign in to comment.