unit test
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package marketing.heyday.hartmann.fotodocumentation.rest;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: heyday Marketing GmbH</p>
|
||||
* @author <a href="mailto:p.verboom@heyday.marketing">Patrick Verboom</a>
|
||||
* @version 1.0
|
||||
*
|
||||
* created: 13 Nov 2024
|
||||
*/
|
||||
public abstract class AbstractFotoTest extends AbstractRestTest {
|
||||
protected int customerCount() {
|
||||
return getCount("select count(*) from customer");
|
||||
}
|
||||
|
||||
protected int pictureCount() {
|
||||
return getCount("select count(*) from picture");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package marketing.heyday.hartmann.fotodocumentation.rest;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: heyday Marketing GmbH</p>
|
||||
* @author <a href="mailto:p.verboom@heyday.marketing">Patrick Verboom</a>
|
||||
* @version 1.0
|
||||
*
|
||||
* created: 13 Nov 2024
|
||||
*/
|
||||
public abstract class AbstractQuestionnaireTest extends AbstractRestTest {
|
||||
protected int customerCount() {
|
||||
return getCount("select count(*) from questionnaire_customer");
|
||||
}
|
||||
|
||||
protected int questionnaireCount() {
|
||||
return getCount("select count(*) from questionnaire");
|
||||
}
|
||||
}
|
||||
@@ -112,12 +112,4 @@ public abstract class AbstractRestTest extends AbstractTest {
|
||||
String className = this.getClass().getName();
|
||||
return getResponseText(httpResponse, () -> className + "-" + name + ".json");
|
||||
}
|
||||
|
||||
protected int customerCount() {
|
||||
return getCount("select count(*) from customer");
|
||||
}
|
||||
|
||||
protected int pictureCount() {
|
||||
return getCount("select count(*) from picture");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.junit.jupiter.api.TestMethodOrder;
|
||||
* created: 14 Nov 2024
|
||||
*/
|
||||
@TestMethodOrder(OrderAnnotation.class)
|
||||
public class CustomerPictureResourceTest extends AbstractRestTest {
|
||||
public class CustomerPictureResourceTest extends AbstractFotoTest {
|
||||
private static final Log LOG = LogFactory.getLog(CustomerPictureResourceTest.class);
|
||||
private static final String PATH = "api/customer-picture";
|
||||
private static final String BASE_UPLOAD = "src/test/resources/upload/";
|
||||
@@ -64,11 +64,8 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
||||
assertEquals(3, customerCount());
|
||||
assertEquals(6, pictureCount());
|
||||
|
||||
String authorization = getBasicHeader();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH;
|
||||
Request request = Request.Post(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization)
|
||||
.bodyFile(new File(BASE_UPLOAD + "addNewCustomer.json"), ContentType.APPLICATION_JSON);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
@@ -84,11 +81,8 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
||||
public void doAddCustomerPictureWrongJson() throws IOException {
|
||||
LOG.info("doAddCustomerPictureWrongJson");
|
||||
|
||||
String authorization = getBasicHeader();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH;
|
||||
Request request = Request.Post(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization)
|
||||
.bodyFile(new File(BASE_UPLOAD + "addWrong.json"), ContentType.APPLICATION_JSON);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.TestMethodOrder;
|
||||
* created: 14 Nov 2024
|
||||
*/
|
||||
@TestMethodOrder(OrderAnnotation.class)
|
||||
public class PictureResourceTest extends AbstractRestTest {
|
||||
public class PictureResourceTest extends AbstractFotoTest {
|
||||
private static final Log LOG = LogFactory.getLog(PictureResourceTest.class);
|
||||
private static final String PATH = "api/picture";
|
||||
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
package marketing.heyday.hartmann.fotodocumentation.rest;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: heyday Marketing GmbH</p>
|
||||
* @author <a href="mailto:p.verboom@heyday.marketing">Patrick Verboom</a>
|
||||
* @version 1.0
|
||||
*
|
||||
* created: 14 Nov 2024
|
||||
*/
|
||||
@TestMethodOrder(OrderAnnotation.class)
|
||||
public class QuestionnaireCustomerResourceTest extends AbstractRestTest {
|
||||
private static final Log LOG = LogFactory.getLog(QuestionnaireCustomerResourceTest.class);
|
||||
private static final String PATH = "api/questionnairecustomer";
|
||||
private static final String BASE_DOWNLOAD = "json/QuestionnaireCustomerResourceTest-";
|
||||
|
||||
@BeforeAll
|
||||
public static void init() {
|
||||
initDB();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doGetAll() throws IOException {
|
||||
LOG.info("doGetAll");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH;
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetAll");
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetAll.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doGetAllStartWith() throws IOException {
|
||||
LOG.info("doGetAllStartWith");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH + "?startsWith=M";
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetAllStartWith");
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetAllStartWith.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doGetAllQueryText() throws IOException {
|
||||
LOG.info("doGetAllQueryText");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH + "?query=2345";
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetAllQueryText");
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetAllQueryText.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doGetAllQueryTextWithStart() throws IOException {
|
||||
LOG.info("doGetAllQueryTextWithStart");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH + "?query=45&startsWith=M";
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetAllQueryTextWithStart");
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetAllQueryTextWithStart.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doGetAllQueryDate1() throws IOException {
|
||||
LOG.info("doGetAllQueryDate");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH + "?query=12.01.2026";
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetAllQueryDate");
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetAllQueryDate.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doGetAllQueryDate2() throws IOException {
|
||||
LOG.info("doGetAllQueryDate");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String query = URLEncoder.encode("12 Januar 2026", Charset.forName("utf-8"));
|
||||
String path = deploymentURL + PATH + "?query=" + query;
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetAllQueryDate");
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetAllQueryDate.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doGetAllQueryDate3() throws IOException {
|
||||
LOG.info("doGetAllQueryDate");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String query = URLEncoder.encode("12. Januar 2026", Charset.forName("utf-8"));
|
||||
String path = deploymentURL + PATH + "?query=" + query;
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetAllQueryDate");
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetAllQueryDate.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doGetCustomer() throws IOException {
|
||||
LOG.info("doGetCustomer");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH + "/1";
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetCustomer");
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetCustomer.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@Disabled // FIXME: enable when we have implemented excel download
|
||||
public void doDownload() throws IOException {
|
||||
LOG.info("doDownload");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH + "/export/1";
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
byte[] text = getResponse(httpResponse);
|
||||
writeFile(text, "doDownload.pdf");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doDownloadNotExist() throws IOException {
|
||||
LOG.info("doDownloadNotExist");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH + "/export/9999";
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(404, code);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package marketing.heyday.hartmann.fotodocumentation.rest;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: heyday Marketing GmbH</p>
|
||||
* @author <a href="mailto:p.verboom@heyday.marketing">Patrick Verboom</a>
|
||||
* @version 1.0
|
||||
*
|
||||
* created: 14 Nov 2024
|
||||
*/
|
||||
@TestMethodOrder(OrderAnnotation.class)
|
||||
public class QuestionnairePublishResourceTest extends AbstractQuestionnaireTest {
|
||||
private static final Log LOG = LogFactory.getLog(QuestionnairePublishResourceTest.class);
|
||||
private static final String PATH = "api/questionnaire-publish";
|
||||
private static final String BASE_UPLOAD = "src/test/resources/upload/";
|
||||
|
||||
@BeforeAll
|
||||
public static void init() {
|
||||
initDB();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@Disabled // FIXME: enable when implemented
|
||||
public void doAddCustomerdoAddQuestionniare() throws IOException {
|
||||
LOG.info("doAddCustomerdoAddQuestionniare");
|
||||
|
||||
assertEquals(3, customerCount());
|
||||
assertEquals(5, questionnaireCount());
|
||||
|
||||
String path = deploymentURL + PATH;
|
||||
Request request = Request.Post(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.bodyFile(new File(BASE_UPLOAD + "add.json"), ContentType.APPLICATION_JSON);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
assertEquals(3, customerCount());
|
||||
assertEquals(6, questionnaireCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@Disabled // FIXME: enable when implemented
|
||||
public void doAddCustomerWithQuestionnaire() throws IOException {
|
||||
LOG.info("doAddCustomerWithQuestionnaire");
|
||||
|
||||
assertEquals(3, customerCount());
|
||||
assertEquals(6, questionnaireCount());
|
||||
|
||||
String path = deploymentURL + PATH;
|
||||
Request request = Request.Post(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.bodyFile(new File(BASE_UPLOAD + "addNewCustomer.json"), ContentType.APPLICATION_JSON);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
assertEquals(4, customerCount());
|
||||
assertEquals(7, questionnaireCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@Disabled // FIXME: enable when implemented
|
||||
public void doAddCustomerWithQuestionnaireWrongJson() throws IOException {
|
||||
LOG.info("doAddCustomerWithQuestionnaireWrongJson");
|
||||
|
||||
String path = deploymentURL + PATH;
|
||||
Request request = Request.Post(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.bodyFile(new File(BASE_UPLOAD + "addWrong.json"), ContentType.APPLICATION_JSON);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(400, code);
|
||||
|
||||
String text = getResponseText(httpResponse, "doGetAll");
|
||||
System.out.println(text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package marketing.heyday.hartmann.fotodocumentation.rest;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: heyday Marketing GmbH</p>
|
||||
* @author <a href="mailto:p.verboom@heyday.marketing">Patrick Verboom</a>
|
||||
* @version 1.0
|
||||
*
|
||||
* created: 14 Nov 2024
|
||||
*/
|
||||
@TestMethodOrder(OrderAnnotation.class)
|
||||
public class QuestionnaireResourceTest extends AbstractQuestionnaireTest {
|
||||
private static final Log LOG = LogFactory.getLog(QuestionnaireResourceTest.class);
|
||||
private static final String PATH = "api/questionnaire";
|
||||
|
||||
@BeforeAll
|
||||
public static void init() {
|
||||
initDB();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
public void doDelete() throws IOException {
|
||||
LOG.info("doDelete");
|
||||
|
||||
assertEquals(5, questionnaireCount());
|
||||
|
||||
String path = deploymentURL + PATH + "/1";
|
||||
Request request = Request.Delete(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", getAuthorization());
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
assertEquals(4, questionnaireCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void doDeleteNotFound() throws IOException {
|
||||
LOG.info("doDeleteNotFound");
|
||||
|
||||
assertEquals(5, questionnaireCount());
|
||||
|
||||
String path = deploymentURL + PATH + "/6000";
|
||||
Request request = Request.Delete(path).addHeader("Accept", "application/json; charset=utf-8")
|
||||
.addHeader("Authorization", getAuthorization());
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(404, code);
|
||||
|
||||
assertEquals(5, questionnaireCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doEvaluation() throws IOException {
|
||||
LOG.info("doEvaluation");
|
||||
|
||||
assertEquals(0, getCount("select count(*) from questionnaire where questionnaire_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 questionnaire where questionnaire_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);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doEvaluationWrongValue() throws IOException {
|
||||
LOG.info("doEvaluationWrongValue");
|
||||
|
||||
String path = deploymentURL + PATH + "/evaluation/1?evaluation=4";
|
||||
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(400, code);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doEvaluationWrongValue2() throws IOException {
|
||||
LOG.info("doEvaluationWrongValue2");
|
||||
|
||||
String path = deploymentURL + PATH + "/evaluation/1?evaluation=0";
|
||||
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(400, code);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doEvaluationNoValue() throws IOException {
|
||||
LOG.info("doEvaluationNoValue");
|
||||
|
||||
String path = deploymentURL + PATH + "/evaluation/1";
|
||||
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(400, code);
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Schmidt Apotheke",
|
||||
"customerNumber": "3456",
|
||||
"lastUpdateDate": 1768212570000
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Meier Apotheke",
|
||||
"customerNumber": "2345",
|
||||
"lastUpdateDate": 1767607770000
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Meier Apotheke",
|
||||
"customerNumber": "2345",
|
||||
"lastUpdateDate": 1767607770000
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Müller Apotheke",
|
||||
"customerNumber": "1234",
|
||||
"lastUpdateDate": 1767348570000
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Meier Apotheke",
|
||||
"customerNumber": "2345",
|
||||
"lastUpdateDate": 1767607770000
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Müller Apotheke",
|
||||
"customerNumber": "1234",
|
||||
"city": "Hannover",
|
||||
"zip": "12345",
|
||||
"questionnaires": [
|
||||
{
|
||||
"id": 1,
|
||||
"comment": "good looking picture 1",
|
||||
"category": null,
|
||||
"questionnaireDate": 1767262170000,
|
||||
"username": "verboomp",
|
||||
"evaluation": 1
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"comment": "good looking picture 2",
|
||||
"category": null,
|
||||
"questionnaireDate": 1767348570000,
|
||||
"username": "verboomp",
|
||||
"evaluation": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Müller Apotheke",
|
||||
"customerNumber": "1234",
|
||||
"lastUpdateDate": 1767348570000
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Meier Apotheke",
|
||||
"customerNumber": "2345",
|
||||
"lastUpdateDate": 1767607770000
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Schmidt Apotheke",
|
||||
"customerNumber": "3456",
|
||||
"lastUpdateDate": 1768212570000
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user