diff --git a/remote-api/src/test/java/org/alfresco/rest/api/impl/TagsImplTest.java b/remote-api/src/test/java/org/alfresco/rest/api/impl/TagsImplTest.java index 2872bb7f0a..09aabf01b2 100644 --- a/remote-api/src/test/java/org/alfresco/rest/api/impl/TagsImplTest.java +++ b/remote-api/src/test/java/org/alfresco/rest/api/impl/TagsImplTest.java @@ -446,16 +446,21 @@ public class TagsImplTest @Test public void testAddTags() { + NodeRef tagNodeA = new NodeRef("tag://A/"); + NodeRef tagNodeB = new NodeRef("tag://B/"); given(nodesMock.validateOrLookupNode(CONTENT_NODE_ID)).willReturn(CONTENT_NODE_REF); given(typeConstraintMock.matches(CONTENT_NODE_REF)).willReturn(true); List> pairs = List.of(new Pair<>("tagA", new NodeRef("tag://A/")), new Pair<>("tagB", new NodeRef("tag://B/"))); List tagNames = pairs.stream().map(Pair::getFirst).collect(toList()); List tags = tagNames.stream().map(name -> Tag.builder().tag(name).create()).collect(toList()); given(taggingServiceMock.addTags(CONTENT_NODE_REF, tagNames)).willReturn(pairs); + given(taggingServiceMock.findTaggedNodesAndCountByTagName(STORE_REF_WORKSPACE_SPACESSTORE)).willReturn(List.of(new Pair<>("tagA", 4))); + given(parametersMock.getInclude()).willReturn(List.of("count")); List actual = objectUnderTest.addTags(CONTENT_NODE_ID, tags, parametersMock); - List expected = pairs.stream().map(pair -> new Tag(pair.getSecond(), pair.getFirst())).collect(toList()); + final List expected = List.of(Tag.builder().tag("tagA").nodeRef(tagNodeA).count(5).create(), + Tag.builder().tag("tagB").nodeRef(tagNodeB).count(1).create()); assertEquals("Unexpected tags returned.", expected, actual); }