public void editTaskTest() throws Exception
{
final String mimeType = "application/xml";
final String representation = "<task><id>4</id><name>Learn new English vocabulary</name></task>";
new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, "/v1/auth/category/School/unresolved/4")
{
@Override
protected void prepareRequest(EnhancedMockHttpServletRequest request)
{
super.prepareRequest(request);
request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
request.addHeader("Content-Type", mimeType);
request.setContentType(mimeType);
request.setContent(representation.getBytes());
}
@Override
protected void onResponse(EnhancedMockHttpServletResponse response)
{
super.onResponse(response);
assertEquals(response.getStatus(), 204, "Unexpected response code.");
}
}.run();
new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/auth/category/School/unresolved/4")
{
@Override
protected void prepareRequest(EnhancedMockHttpServletRequest request)
{