Skip to content

Instantly share code, notes, and snippets.

@hisamekms
Created July 17, 2014 04:08
Show Gist options
  • Save hisamekms/466494965417eb086ea7 to your computer and use it in GitHub Desktop.
Save hisamekms/466494965417eb086ea7 to your computer and use it in GitHub Desktop.
Jersey Test FrameworkとGuiceを一緒に使う ref: http://qiita.com/hisamekms/items/85de686f32d3a5d6fd4f
package web.resources;
import web.MyApplication;
import org.glassfish.jersey.test.DeploymentContext;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class HelloResourceTest extends JerseyTest {
@Test
public void testHello() throws Exception {
String response = target("hello").request().get(String.class);
assertThat(response, is("Hello!"));
}
@Override
protected DeploymentContext configureDeployment() {
return DeploymentContext.newInstance(MyApplication.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment