Skip to content

Commit 1a77837

Browse files
author
Max Klyga
committed
Fix tests to run on JRE 7
1 parent f2d064b commit 1a77837

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/test/java/io/getstream/client/FlatFeedTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import okhttp3.OkHttpClient;
1414
import org.junit.Test;
1515

16+
import java.util.Collections;
1617
import java.util.List;
1718
import java.util.Optional;
1819

@@ -48,9 +49,11 @@ public void getEnrichedActivities() throws Exception {
4849
.withUserReactions("some-user")
4950
.withReactionCounts()
5051
.withRecentReactions()).join();
51-
result.sort((a, b) -> {
52-
int aLikes = a.getReactionCounts().getOrDefault("like", 0).intValue();
53-
int bLikes = b.getReactionCounts().getOrDefault("like", 0).intValue();
52+
Collections.sort(result, (a, b) -> {
53+
Number aValue = a.getReactionCounts().get("like");
54+
Number bValue = b.getReactionCounts().get("like");
55+
int aLikes = aValue == null ? 0 : aValue.intValue();
56+
int bLikes = bValue == null ? 0 : bValue.intValue();
5457
return aLikes - bLikes;
5558
});
5659
}

0 commit comments

Comments
 (0)