@Test public void notices_changes_in_avatar_and_title_but_not_members_in_placeholder() { UUID newMemberUuid = UUID.randomUUID(); DecryptedMember newMember = DecryptedMember.newBuilder() .setUuid(UuidUtil.toByteString(newMemberUuid)) .build(); DecryptedMember existingMember = DecryptedMember.newBuilder() .setUuid(UuidUtil.toByteString(UUID.randomUUID())) .build(); DecryptedGroup currentState = DecryptedGroup.newBuilder() .setRevision(GroupStateMapper.PLACEHOLDER_REVISION) .setTitle("Incorrect group title") .setAvatar("Incorrect group avatar") .addMembers(newMember) .build(); ServerGroupLogEntry log8 = new ServerGroupLogEntry(DecryptedGroup.newBuilder() .setRevision(8) .addMembers(newMember) .addMembers(existingMember) .setTitle("Group Revision " + 8) .setAvatar("Group Avatar " + 8) .build(), DecryptedGroupChange.newBuilder() .setRevision(8) .setEditor(UuidUtil.toByteString(newMemberUuid)) .addNewMembers(newMember) .build()); DecryptedGroupChange expectedChange = DecryptedGroupChange.newBuilder() .setRevision(8) .setNewTitle(DecryptedString.newBuilder().setValue("Group Revision " + 8)) .setNewAvatar(DecryptedString.newBuilder().setValue("Group Avatar " + 8)) .build(); AdvanceGroupStateResult advanceGroupStateResult = GroupStateMapper.partiallyAdvanceGroupState(new GlobalGroupState(currentState, singletonList(log8)), LATEST); assertNotNull(log8.getGroup()); assertThat(advanceGroupStateResult.getProcessedLogEntries(), is(singletonList(new LocalGroupLogEntry(log8.getGroup(), expectedChange)))); assertNewState(new GlobalGroupState(log8.getGroup(), emptyList()), advanceGroupStateResult.getNewGlobalGroupState()); assertEquals(log8.getGroup(), advanceGroupStateResult.getNewGlobalGroupState().getLocalState()); }
static @NonNull AdvanceGroupStateResult partiallyAdvanceGroupState(@NonNull GlobalGroupState inputState, int maximumRevisionToApply) { AdvanceGroupStateResult groupStateResult = processChanges(inputState, maximumRevisionToApply); return cleanDuplicatedChanges(groupStateResult, inputState.getLocalState()); }
GroupStateMapper { static @NonNull AdvanceGroupStateResult partiallyAdvanceGroupState(@NonNull GlobalGroupState inputState, int maximumRevisionToApply) { AdvanceGroupStateResult groupStateResult = processChanges(inputState, maximumRevisionToApply); return cleanDuplicatedChanges(groupStateResult, inputState.getLocalState()); } }
GroupStateMapper { static @NonNull AdvanceGroupStateResult partiallyAdvanceGroupState(@NonNull GlobalGroupState inputState, int maximumRevisionToApply) { AdvanceGroupStateResult groupStateResult = processChanges(inputState, maximumRevisionToApply); return cleanDuplicatedChanges(groupStateResult, inputState.getLocalState()); } private  GroupStateMapper(); }
GroupStateMapper { static @NonNull AdvanceGroupStateResult partiallyAdvanceGroupState(@NonNull GlobalGroupState inputState, int maximumRevisionToApply) { AdvanceGroupStateResult groupStateResult = processChanges(inputState, maximumRevisionToApply); return cleanDuplicatedChanges(groupStateResult, inputState.getLocalState()); } private  GroupStateMapper();  }
GroupStateMapper { static @NonNull AdvanceGroupStateResult partiallyAdvanceGroupState(@NonNull GlobalGroupState inputState, int maximumRevisionToApply) { AdvanceGroupStateResult groupStateResult = processChanges(inputState, maximumRevisionToApply); return cleanDuplicatedChanges(groupStateResult, inputState.getLocalState()); } private  GroupStateMapper();   }