Skip to content

Commit f159dd8

Browse files
committed
[TODO CHECK THAT] Fix WidgetControllerTest
1 parent dc5d98b commit f159dd8

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

src/test/java/com/epam/reportportal/ws/controller/WidgetControllerTest.java

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package com.epam.reportportal.ws.controller;
1818

19+
import static org.hamcrest.Matchers.allOf;
20+
import static org.hamcrest.Matchers.hasEntry;
21+
import static org.hamcrest.Matchers.hasItem;
1922
import static org.hamcrest.Matchers.hasSize;
2023
import static org.junit.jupiter.api.Assertions.assertEquals;
2124
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -772,15 +775,21 @@ void getActivityStreamWidget() throws Exception {
772775
.andExpect(content().contentType("application/json"))
773776
.andExpect(jsonPath("$.name").value("activity stream"))
774777
.andExpect(jsonPath("$.widgetType").value("activityStream"))
775-
.andExpect(jsonPath("$.content.result[2].user").value(SUPERADMIN_USERNAME))
776-
.andExpect(jsonPath("$.content.result[2].actionType").value("startLaunch"))
777-
.andExpect(jsonPath("$.content.result[2].objectType").value("LAUNCH"))
778-
.andExpect(jsonPath("$.content.result[1].user").value(SUPERADMIN_USERNAME))
779-
.andExpect(jsonPath("$.content.result[1].actionType").value("updateItem"))
780-
.andExpect(jsonPath("$.content.result[1].objectType").value("ITEM"))
781-
.andExpect(jsonPath("$.content.result[0].user").value(SUPERADMIN_USERNAME))
782-
.andExpect(jsonPath("$.content.result[0].actionType").value("deleteLaunch"))
783-
.andExpect(jsonPath("$.content.result[0].objectType").value("LAUNCH"));
778+
.andExpect(jsonPath("$.content.result", hasItem(allOf(
779+
hasEntry("user", SUPERADMIN_USERNAME),
780+
hasEntry("actionType", "startLaunch"),
781+
hasEntry("objectType", "LAUNCH")
782+
))))
783+
.andExpect(jsonPath("$.content.result", hasItem(allOf(
784+
hasEntry("user", SUPERADMIN_USERNAME),
785+
hasEntry("actionType", "updateItem"),
786+
hasEntry("objectType", "ITEM")
787+
))))
788+
.andExpect(jsonPath("$.content.result", hasItem(allOf(
789+
hasEntry("user", SUPERADMIN_USERNAME),
790+
hasEntry("actionType", "deleteLaunch"),
791+
hasEntry("objectType", "LAUNCH")
792+
))));
784793
}
785794

786795
@Sql("/db/widget/activity-stream.sql")
@@ -809,15 +818,21 @@ void getActivityStreamWidgetWithEmptyUserOption() throws Exception {
809818
.andExpect(content().contentType("application/json"))
810819
.andExpect(jsonPath("$.name").value("activity stream"))
811820
.andExpect(jsonPath("$.widgetType").value("activityStream"))
812-
.andExpect(jsonPath("$.content.result[2].user").value(SUPERADMIN_USERNAME))
813-
.andExpect(jsonPath("$.content.result[2].actionType").value("startLaunch"))
814-
.andExpect(jsonPath("$.content.result[2].objectType").value("LAUNCH"))
815-
.andExpect(jsonPath("$.content.result[1].user").value(SUPERADMIN_USERNAME))
816-
.andExpect(jsonPath("$.content.result[1].actionType").value("updateItem"))
817-
.andExpect(jsonPath("$.content.result[1].objectType").value("ITEM"))
818-
.andExpect(jsonPath("$.content.result[0].user").value(SUPERADMIN_USERNAME))
819-
.andExpect(jsonPath("$.content.result[0].actionType").value("deleteLaunch"))
820-
.andExpect(jsonPath("$.content.result[0].objectType").value("LAUNCH"));
821+
.andExpect(jsonPath("$.content.result", hasItem(allOf(
822+
hasEntry("user", SUPERADMIN_USERNAME),
823+
hasEntry("actionType", "startLaunch"),
824+
hasEntry("objectType", "LAUNCH")
825+
))))
826+
.andExpect(jsonPath("$.content.result", hasItem(allOf(
827+
hasEntry("user", SUPERADMIN_USERNAME),
828+
hasEntry("actionType", "updateItem"),
829+
hasEntry("objectType", "ITEM")
830+
))))
831+
.andExpect(jsonPath("$.content.result", hasItem(allOf(
832+
hasEntry("user", SUPERADMIN_USERNAME),
833+
hasEntry("actionType", "deleteLaunch"),
834+
hasEntry("objectType", "LAUNCH")
835+
))));
821836
}
822837

823838
@Sql("/db/widget/product-status.sql")

0 commit comments

Comments
 (0)