@Test public void can_extract_uuids_for_all_pending_including_bad_entries() { UUID uuid1 = UUID.randomUUID(); UUID uuid2 = UUID.randomUUID(); DecryptedPendingMember decryptedMember1 = DecryptedPendingMember.newBuilder() .setUuid(UuidUtil.toByteString(uuid1)) .build(); DecryptedPendingMember decryptedMember2 = DecryptedPendingMember.newBuilder() .setUuid(UuidUtil.toByteString(uuid2)) .build(); DecryptedPendingMember decryptedMember3 = DecryptedPendingMember.newBuilder() .setUuid(ByteString.copyFrom(Util.getSecretBytes(17))) .build(); DecryptedGroupChange groupChange = DecryptedGroupChange.newBuilder() .addNewPendingMembers(decryptedMember1) .addNewPendingMembers(decryptedMember2) .addNewPendingMembers(decryptedMember3) .build(); List<UUID> pendingUuids = DecryptedGroupUtil.pendingToUuidList(groupChange.getNewPendingMembersList()); assertThat(pendingUuids, is(asList(uuid1, uuid2, UuidUtil.UNKNOWN_UUID))); }
public static ArrayList<UUID> pendingToUuidList(Collection<DecryptedPendingMember> membersList) { ArrayList<UUID> uuidList = new ArrayList<>(membersList.size()); for (DecryptedPendingMember member : membersList) { uuidList.add(toUuid(member)); } return uuidList; }
DecryptedGroupUtil { public static ArrayList<UUID> pendingToUuidList(Collection<DecryptedPendingMember> membersList) { ArrayList<UUID> uuidList = new ArrayList<>(membersList.size()); for (DecryptedPendingMember member : membersList) { uuidList.add(toUuid(member)); } return uuidList; } }
DecryptedGroupUtil { public static ArrayList<UUID> pendingToUuidList(Collection<DecryptedPendingMember> membersList) { ArrayList<UUID> uuidList = new ArrayList<>(membersList.size()); for (DecryptedPendingMember member : membersList) { uuidList.add(toUuid(member)); } return uuidList; }  }
DecryptedGroupUtil { public static ArrayList<UUID> pendingToUuidList(Collection<DecryptedPendingMember> membersList) { ArrayList<UUID> uuidList = new ArrayList<>(membersList.size()); for (DecryptedPendingMember member : membersList) { uuidList.add(toUuid(member)); } return uuidList; }  static ArrayList<UUID> toUuidList(Collection<DecryptedMember> membersList); static ArrayList<UUID> membersToUuidList(Collection<DecryptedMember> membersList); static Set<ByteString> membersToUuidByteStringSet(Collection<DecryptedMember> membersList); static ArrayList<UUID> pendingToUuidList(Collection<DecryptedPendingMember> membersList); static ArrayList<UUID> removedMembersUuidList(DecryptedGroupChange groupChange); static ArrayList<UUID> removedPendingMembersUuidList(DecryptedGroupChange groupChange); static ArrayList<UUID> removedRequestingMembersUuidList(DecryptedGroupChange groupChange); static UUID toUuid(DecryptedMember member); static UUID toUuid(DecryptedPendingMember member); static Optional<UUID> editorUuid(DecryptedGroupChange change); static Optional<DecryptedMember> findMemberByUuid(Collection<DecryptedMember> members, UUID uuid); static Optional<DecryptedPendingMember> findPendingByUuid(Collection<DecryptedPendingMember> members, UUID uuid); static Optional<DecryptedRequestingMember> findRequestingByUuid(Collection<DecryptedRequestingMember> members, UUID uuid); static boolean isPendingOrRequesting(DecryptedGroup group, UUID uuid); static DecryptedGroup removeMember(DecryptedGroup group, UUID uuid, int revision); static DecryptedGroup apply(DecryptedGroup group, DecryptedGroupChange change); static DecryptedGroup applyWithoutRevisionCheck(DecryptedGroup group, DecryptedGroupChange change); static Optional<UUID> findInviter(List<DecryptedPendingMember> pendingMembersList, UUID uuid); static boolean changeIsEmpty(DecryptedGroupChange change); static boolean changeIsEmptyExceptForProfileKeyChanges(DecryptedGroupChange change); }
DecryptedGroupUtil { public static ArrayList<UUID> pendingToUuidList(Collection<DecryptedPendingMember> membersList) { ArrayList<UUID> uuidList = new ArrayList<>(membersList.size()); for (DecryptedPendingMember member : membersList) { uuidList.add(toUuid(member)); } return uuidList; }  static ArrayList<UUID> toUuidList(Collection<DecryptedMember> membersList); static ArrayList<UUID> membersToUuidList(Collection<DecryptedMember> membersList); static Set<ByteString> membersToUuidByteStringSet(Collection<DecryptedMember> membersList); static ArrayList<UUID> pendingToUuidList(Collection<DecryptedPendingMember> membersList); static ArrayList<UUID> removedMembersUuidList(DecryptedGroupChange groupChange); static ArrayList<UUID> removedPendingMembersUuidList(DecryptedGroupChange groupChange); static ArrayList<UUID> removedRequestingMembersUuidList(DecryptedGroupChange groupChange); static UUID toUuid(DecryptedMember member); static UUID toUuid(DecryptedPendingMember member); static Optional<UUID> editorUuid(DecryptedGroupChange change); static Optional<DecryptedMember> findMemberByUuid(Collection<DecryptedMember> members, UUID uuid); static Optional<DecryptedPendingMember> findPendingByUuid(Collection<DecryptedPendingMember> members, UUID uuid); static Optional<DecryptedRequestingMember> findRequestingByUuid(Collection<DecryptedRequestingMember> members, UUID uuid); static boolean isPendingOrRequesting(DecryptedGroup group, UUID uuid); static DecryptedGroup removeMember(DecryptedGroup group, UUID uuid, int revision); static DecryptedGroup apply(DecryptedGroup group, DecryptedGroupChange change); static DecryptedGroup applyWithoutRevisionCheck(DecryptedGroup group, DecryptedGroupChange change); static Optional<UUID> findInviter(List<DecryptedPendingMember> pendingMembersList, UUID uuid); static boolean changeIsEmpty(DecryptedGroupChange change); static boolean changeIsEmptyExceptForProfileKeyChanges(DecryptedGroupChange change);  }