|
1 | 1 | package edu.harvard.iq.dataverse.api; |
2 | 2 |
|
| 3 | +import edu.harvard.iq.dataverse.util.SystemConfig; |
| 4 | +import static edu.harvard.iq.dataverse.util.SystemConfig.UI.JSF; |
| 5 | +import static edu.harvard.iq.dataverse.util.SystemConfig.UI.SPA; |
3 | 6 | import io.restassured.RestAssured; |
4 | 7 | import io.restassured.path.json.JsonPath; |
5 | 8 | import io.restassured.response.Response; |
6 | 9 | import java.util.logging.Logger; |
7 | 10 | import static jakarta.ws.rs.core.Response.Status.CREATED; |
8 | 11 | import static jakarta.ws.rs.core.Response.Status.OK; |
| 12 | +import org.hamcrest.CoreMatchers; |
| 13 | +import static org.hamcrest.CoreMatchers.containsString; |
9 | 14 | import static org.hamcrest.CoreMatchers.equalTo; |
10 | 15 | import org.junit.jupiter.api.BeforeAll; |
11 | 16 | import org.junit.jupiter.api.Test; |
@@ -41,14 +46,24 @@ public void testNotifications() { |
41 | 46 | createDataset.prettyPrint(); |
42 | 47 | createDataset.then().assertThat() |
43 | 48 | .statusCode(CREATED.getStatusCode()); |
44 | | - Response getNotifications = UtilIT.getNotifications(authorApiToken); |
45 | | - getNotifications.prettyPrint(); |
46 | | - getNotifications.then().assertThat() |
| 49 | + |
| 50 | + Response getNotificationsJSF = UtilIT.getNotifications(authorApiToken, JSF); |
| 51 | + getNotificationsJSF.prettyPrint(); |
| 52 | + getNotificationsJSF.then().assertThat() |
| 53 | + .body("data.notifications[0].type", equalTo("CREATEACC")) |
| 54 | + .body("data.notifications[0].messageText", containsString("xhtml")) |
| 55 | + .body("data.notifications[1]", equalTo(null)) |
| 56 | + .statusCode(OK.getStatusCode()); |
| 57 | + |
| 58 | + Response getNotificationsSpa = UtilIT.getNotifications(authorApiToken, SPA); |
| 59 | + getNotificationsSpa.prettyPrint(); |
| 60 | + getNotificationsSpa.then().assertThat() |
47 | 61 | .body("data.notifications[0].type", equalTo("CREATEACC")) |
| 62 | + .body("data.notifications[0].messageText", CoreMatchers.not(containsString("xhtml"))) |
48 | 63 | .body("data.notifications[1]", equalTo(null)) |
49 | 64 | .statusCode(OK.getStatusCode()); |
50 | 65 |
|
51 | | - long id = JsonPath.from(getNotifications.getBody().asString()).getLong("data.notifications[0].id"); |
| 66 | + long id = JsonPath.from(getNotificationsSpa.getBody().asString()).getLong("data.notifications[0].id"); |
52 | 67 |
|
53 | 68 | Response deleteNotification = UtilIT.deleteNotification(id, authorApiToken); |
54 | 69 | deleteNotification.prettyPrint(); |
|
0 commit comments