use of org.everrest.core.tools.ByteArrayContainerResponseWriter in project che by eclipse.
the class ProjectServiceTest method testGetFileContent.
@Test
public void testGetFileContent() throws Exception {
String myContent = "to be or not to be";
pm.getProject("my_project").getBaseFolder().createFile("test.txt", myContent.getBytes(Charset.defaultCharset()));
ByteArrayContainerResponseWriter writer = new ByteArrayContainerResponseWriter();
ContainerResponse response = launcher.service(GET, "http://localhost:8080/api/project/file/my_project/test.txt", "http://localhost:8080/api", null, null, writer, null);
assertEquals(response.getStatus(), 200, "Error: " + response.getEntity());
assertEquals(response.getContentType().toString(), TEXT_PLAIN);
assertEquals(new String(writer.getBody()), myContent);
}
Aggregations