From e43b64a9ea8bf80ec62cd59ad4eed19b112f5093 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 13 Mar 2024 02:20:33 +0300 Subject: ActivityPub: handle Flag with multiple objects TODO: refactor Activity to handle multiple objects --- src/test/java/com/juick/server/tests/ServerTests.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/test/java/com') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 0724eb4f..b97ae8a3 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -217,6 +217,8 @@ public class ServerTests { private Resource nojfif; @Value("classpath:hubzilla_activity.json") private Resource hubzillaActivity; + @Value("classpath:flag.json") + private Resource mastodonFlag; @Value("classpath:hubzilla_follow.json") private Resource hubzillaFollow; @Value("classpath:to_as_string.json") @@ -2275,7 +2277,7 @@ public class ServerTests { } @Test - public void hubzillaAndHonkActorAndFriendicaUpdate() throws Exception { + public void hubzillaAndHonkActorAndFriendicaUpdateAndMastodonFlag() throws Exception { String activity = IOUtils.toString(hubzillaActivity.getInputStream(), StandardCharsets.UTF_8); Create create = jsonMapper.readValue(activity, Create.class); String followData = IOUtils.toString(hubzillaFollow.getInputStream(), StandardCharsets.UTF_8); @@ -2286,6 +2288,9 @@ public class ServerTests { assertThat(hfollow.getTo().get(0), is("https://juick.com/u/vt")); String updateString = IOUtils.toString(friendicaUpdate.getInputStream(), StandardCharsets.UTF_8); Update update = jsonMapper.readValue(updateString, Update.class); + String flagString = IOUtils.toString(mastodonFlag.getInputStream(), StandardCharsets.UTF_8); + Flag flag = (Flag) jsonMapper.readValue(flagString, Context.class); + assertThat(flag.getObject().size(), is(3)); } @Test -- cgit v1.2.3