From 3188babc5e9acb46816a6d4a917c31340af11298 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 6 Jul 2019 14:31:16 +0300 Subject: ActivityPub contexts already have type, no need to duplicate --- src/test/java/com/juick/server/tests/ServerTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/test') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index de742447..53fbbf1d 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -37,6 +37,7 @@ import com.juick.server.*; import com.juick.server.api.activity.Profile; import com.juick.server.api.activity.model.Context; import com.juick.server.api.activity.model.activities.*; +import com.juick.server.api.activity.model.objects.Mention; import com.juick.server.api.activity.model.objects.Note; import com.juick.server.api.activity.model.objects.Person; import com.juick.server.api.webfinger.model.Account; @@ -2153,4 +2154,13 @@ public class ServerTests { .orElseThrow(); assertThat(htmlPM, is(getSnapshot(testPrivateHtmlEmail))); } + @Test + public void mentionShouldNotDuplicateType() throws Exception { + Mention mention = new Mention("http://localhost/u/ugnich", "ugnich"); + String mentionStr = jsonMapper.writeValueAsString(mention); + Context mentionFromString = jsonMapper.readValue(mentionStr, Context.class); + assertThat(mention, is(samePropertyValuesAs(mentionFromString))); + JsonNode mentionNode = jsonMapper.readTree(mentionStr); + assertThat(mentionNode.findValues("type").size(), is(1)); + } } -- cgit v1.2.3