Fix resend after safety number change in groups or distribution lists.

This commit is contained in:
Cody Henthorne
2022-04-05 11:56:13 -04:00
parent 2253e25ae1
commit c56ef33833
6 changed files with 123 additions and 59 deletions

View File

@@ -1,11 +1,17 @@
package org.thoughtcrime.securesms.recipients;
import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
@@ -43,6 +49,13 @@ public final class RecipientIdSerializationTest {
assertThat(RecipientId.fromSerializedList("123,456"), is(asList(RecipientId.from(123), RecipientId.from(456))));
}
@Test
public void fromSerializedList_recipient_serialize() {
List<RecipientId> recipientIds = RecipientId.fromSerializedList(RecipientId.from(123).serialize());
assertThat(recipientIds, hasSize(1));
assertThat(recipientIds, contains(RecipientId.from(123)));
}
@Test
public void serializedListContains_empty_list_does_not_contain_item() {
assertFalse(RecipientId.serializedListContains("", RecipientId.from(456)));