mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-01 10:26:47 +00:00
Update serialization test
This commit is contained in:
1 parent
0281756c01
commit
c70674ed26
1 file changed
+6
-11
+6
-11
@@ -17,9 +17,8 @@ class AccountAttributesTest {
|
||||
|
||||
private static final ObjectMapper mapper = SystemMapper.jsonMapper();
|
||||
|
||||
|
||||
@Test
|
||||
void testSerializationDeserialization() throws Exception {
|
||||
void testSerializationDeserializationRoundTrip() throws Exception {
|
||||
|
||||
final String originalJson = testJson();
|
||||
|
||||
@@ -28,31 +27,27 @@ class AccountAttributesTest {
|
||||
assertEquals(originalJson, mapper.writerWithDefaultPrettyPrinter().writeValueAsString(attributes));
|
||||
}
|
||||
|
||||
|
||||
private static String testJson() {
|
||||
|
||||
return String.format("""
|
||||
{
|
||||
"fetchesMessages" : false,
|
||||
"registrationId" : 123,
|
||||
"pniRegistrationId" : 456,
|
||||
"name" : "%s",
|
||||
"registrationLock" : null,
|
||||
"unidentifiedAccessKey" : "%s",
|
||||
"unrestrictedUnidentifiedAccess" : false,
|
||||
"capabilities" : {
|
||||
"storage" : true
|
||||
},
|
||||
"registrationLock" : null,
|
||||
"unidentifiedAccessKey" : "%s",
|
||||
"unrestrictedUnidentifiedAccess" : false,
|
||||
"discoverableByPhoneNumber" : true,
|
||||
"recoveryPassword" : "%s",
|
||||
"pniRegistrationId" : 456
|
||||
"recoveryPassword" : "%s"
|
||||
}
|
||||
""",
|
||||
Base64.getEncoder().withoutPadding().encodeToString(TestRandomUtil.nextBytes(128)), // name
|
||||
Base64.getEncoder().encodeToString(TestRandomUtil.nextBytes(16)), // unidentifiedAccessKey
|
||||
Base64.getEncoder().encodeToString(TestRandomUtil.nextBytes(32)) // recoveryPassword
|
||||
).trim();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user