added unit test
This commit is contained in:
@@ -34,7 +34,7 @@ public class PictureResourceTest extends AbstractRestTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@Order(3)
|
||||
public void doDelete() throws IOException {
|
||||
LOG.info("doDelete");
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PictureResourceTest extends AbstractRestTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@Order(2)
|
||||
public void doDeleteNotFound() throws IOException {
|
||||
LOG.info("doDeleteNotFound");
|
||||
|
||||
@@ -69,4 +69,37 @@ public class PictureResourceTest extends AbstractRestTest {
|
||||
assertEquals(5, pictureCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doEvaluation() throws IOException {
|
||||
LOG.info("doEvaluation");
|
||||
|
||||
assertEquals(0, getCount("select count(*) from picture where picture_id = 1 and evaluation = 3"));
|
||||
|
||||
|
||||
|
||||
String path = deploymentURL + PATH + "/evaluation/1?evaluation=3";
|
||||
Request request = Request.Put(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", getAuthorization());
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
assertEquals(1, getCount("select count(*) from picture where picture_id = 1 and evaluation = 3"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doEvaluationNotFound() throws IOException {
|
||||
LOG.info("doEvaluationNotFound");
|
||||
|
||||
String path = deploymentURL + PATH + "/evaluation/6000?evaluation=3";
|
||||
Request request = Request.Put(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", getAuthorization());
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(404, code);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user