Skip to content

Commit f700012

Browse files
committed
chore: update tests
1 parent 5f27a4c commit f700012

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/test/java/io/getstream/FeedIntegrationTests.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class FeedIntegrationTests {
2929

3030
private static String testUserId;
3131
private static String testUserId2; // For follow operations
32+
private static Feed testFeed;
33+
private static Feed testFeed2; // For follow operations
3234
private static String testFeedId;
3335
private static String testFeedId2;
3436

@@ -84,17 +86,19 @@ private static void setupEnvironment() throws Exception {
8486

8587
// Create feeds
8688
// snippet-start: GetOrCreateFeed
89+
testFeed = new Feed("user", testUserId, feeds);
90+
testFeed2 = new Feed("user", testUserId2, feeds);
91+
8792
GetOrCreateFeedRequest feedRequest1 =
8893
GetOrCreateFeedRequest.builder().userID(testUserId).build();
8994
GetOrCreateFeedRequest feedRequest2 =
9095
GetOrCreateFeedRequest.builder().userID(testUserId2).build();
9196

92-
GetOrCreateFeedResponse feedResponse1 =
93-
feeds.getOrCreateFeed("user", testUserId, feedRequest1).execute().getData();
94-
GetOrCreateFeedResponse feedResponse2 =
95-
feeds.getOrCreateFeed("user", testUserId2, feedRequest2).execute().getData();
97+
GetOrCreateFeedResponse feedResponse1 = testFeed.getOrCreate(feedRequest1).getData();
98+
GetOrCreateFeedResponse feedResponse2 = testFeed2.getOrCreate(feedRequest2).getData();
9699
testFeedId = feedResponse1.getFeed().getFeed();
97100
testFeedId2 = feedResponse2.getFeed().getFeed();
101+
98102
// snippet-end: GetOrCreateFeed
99103
} catch (Exception e) {
100104
System.err.println("⚠️ Setup failed: " + e.getMessage());
@@ -785,8 +789,7 @@ void test17_PinActivity() throws Exception {
785789
// snippet-start: PinActivity
786790
PinActivityRequest pinRequest = PinActivityRequest.builder().userID(testUserId).build();
787791

788-
PinActivityResponse response =
789-
feeds.pinActivity("user", testUserId, activityId, pinRequest).execute().getData();
792+
PinActivityResponse response = testFeed.pinActivity(activityId, pinRequest).getData();
790793
// snippet-end: PinActivity
791794

792795
Assertions.assertNotNull(response.getActivity());
@@ -814,13 +817,12 @@ void test18_UnpinActivity() throws Exception {
814817
// Pin it first
815818
PinActivityRequest pinRequest = PinActivityRequest.builder().userID(testUserId).build();
816819

817-
feeds.pinActivity("user", testUserId, activityId, pinRequest).execute();
820+
testFeed.pinActivity(activityId, pinRequest);
818821

819822
// snippet-start: UnpinActivity
820823
UnpinActivityRequest unpinRequest = UnpinActivityRequest.builder().UserID(testUserId).build();
821824

822-
UnpinActivityResponse response =
823-
feeds.unpinActivity("user", testUserId, activityId, unpinRequest).execute().getData();
825+
UnpinActivityResponse response = testFeed.unpinActivity(activityId, unpinRequest).getData();
824826
// snippet-end: UnpinActivity
825827

826828
Assertions.assertNotNull(response.getActivity());

0 commit comments

Comments
 (0)