|
15 | 15 | import static org.mockito.Mockito.verify;
|
16 | 16 | import static org.mockito.Mockito.when;
|
17 | 17 |
|
| 18 | +import java.nio.charset.StandardCharsets; |
18 | 19 | import java.util.ArrayList;
|
19 |
| -import java.util.Base64; |
20 | 20 | import java.util.Collections;
|
21 | 21 | import java.util.HashMap;
|
22 | 22 | import java.util.List;
|
@@ -150,7 +150,7 @@ void changeNumberSetPrimaryDevicePrekeyAndSendMessages() throws Exception {
|
150 | 150 |
|
151 | 151 | final IncomingMessage msg = mock(IncomingMessage.class);
|
152 | 152 | when(msg.destinationDeviceId()).thenReturn(deviceId2);
|
153 |
| - when(msg.content()).thenReturn(Base64.getEncoder().encodeToString(new byte[]{1})); |
| 153 | + when(msg.content()).thenReturn(new byte[]{1}); |
154 | 154 |
|
155 | 155 | changeNumberManager.changeNumber(account, changedE164, pniIdentityKey, prekeys, null, List.of(msg), registrationIds);
|
156 | 156 |
|
@@ -203,7 +203,7 @@ void changeNumberSetPrimaryDevicePrekeyPqAndSendMessages() throws Exception {
|
203 | 203 |
|
204 | 204 | final IncomingMessage msg = mock(IncomingMessage.class);
|
205 | 205 | when(msg.destinationDeviceId()).thenReturn(deviceId2);
|
206 |
| - when(msg.content()).thenReturn(Base64.getEncoder().encodeToString(new byte[]{1})); |
| 206 | + when(msg.content()).thenReturn(new byte[]{1}); |
207 | 207 |
|
208 | 208 | changeNumberManager.changeNumber(account, changedE164, pniIdentityKey, prekeys, pqPrekeys, List.of(msg), registrationIds);
|
209 | 209 |
|
@@ -254,7 +254,7 @@ void changeNumberSameNumberSetPrimaryDevicePrekeyAndSendMessages() throws Except
|
254 | 254 |
|
255 | 255 | final IncomingMessage msg = mock(IncomingMessage.class);
|
256 | 256 | when(msg.destinationDeviceId()).thenReturn(deviceId2);
|
257 |
| - when(msg.content()).thenReturn(Base64.getEncoder().encodeToString(new byte[]{1})); |
| 257 | + when(msg.content()).thenReturn(new byte[]{1}); |
258 | 258 |
|
259 | 259 | changeNumberManager.changeNumber(account, originalE164, pniIdentityKey, prekeys, pqPrekeys, List.of(msg), registrationIds);
|
260 | 260 |
|
@@ -301,7 +301,7 @@ void updatePniKeysSetPrimaryDevicePrekeyAndSendMessages() throws Exception {
|
301 | 301 |
|
302 | 302 | final IncomingMessage msg = mock(IncomingMessage.class);
|
303 | 303 | when(msg.destinationDeviceId()).thenReturn(deviceId2);
|
304 |
| - when(msg.content()).thenReturn(Base64.getEncoder().encodeToString(new byte[]{1})); |
| 304 | + when(msg.content()).thenReturn(new byte[]{1}); |
305 | 305 |
|
306 | 306 | changeNumberManager.updatePniKeys(account, pniIdentityKey, prekeys, null, List.of(msg), registrationIds);
|
307 | 307 |
|
@@ -350,7 +350,7 @@ void updatePniKeysSetPrimaryDevicePrekeyPqAndSendMessages() throws Exception {
|
350 | 350 |
|
351 | 351 | final IncomingMessage msg = mock(IncomingMessage.class);
|
352 | 352 | when(msg.destinationDeviceId()).thenReturn(deviceId2);
|
353 |
| - when(msg.content()).thenReturn(Base64.getEncoder().encodeToString(new byte[]{1})); |
| 353 | + when(msg.content()).thenReturn(new byte[]{1}); |
354 | 354 |
|
355 | 355 | changeNumberManager.updatePniKeys(account, pniIdentityKey, prekeys, pqPrekeys, List.of(msg), registrationIds);
|
356 | 356 |
|
@@ -393,8 +393,8 @@ void changeNumberMismatchedRegistrationId() {
|
393 | 393 | final byte destinationDeviceId2 = 2;
|
394 | 394 | final byte destinationDeviceId3 = 3;
|
395 | 395 | final List<IncomingMessage> messages = List.of(
|
396 |
| - new IncomingMessage(1, destinationDeviceId2, 1, "foo"), |
397 |
| - new IncomingMessage(1, destinationDeviceId3, 1, "foo")); |
| 396 | + new IncomingMessage(1, destinationDeviceId2, 1, "foo".getBytes(StandardCharsets.UTF_8)), |
| 397 | + new IncomingMessage(1, destinationDeviceId3, 1, "foo".getBytes(StandardCharsets.UTF_8))); |
398 | 398 |
|
399 | 399 | final ECKeyPair pniIdentityKeyPair = Curve.generateKeyPair();
|
400 | 400 | final ECPublicKey pniIdentityKey = pniIdentityKeyPair.getPublicKey();
|
@@ -431,8 +431,8 @@ void updatePniKeysMismatchedRegistrationId() {
|
431 | 431 | final byte destinationDeviceId2 = 2;
|
432 | 432 | final byte destinationDeviceId3 = 3;
|
433 | 433 | final List<IncomingMessage> messages = List.of(
|
434 |
| - new IncomingMessage(1, destinationDeviceId2, 1, "foo"), |
435 |
| - new IncomingMessage(1, destinationDeviceId3, 1, "foo")); |
| 434 | + new IncomingMessage(1, destinationDeviceId2, 1, "foo".getBytes(StandardCharsets.UTF_8)), |
| 435 | + new IncomingMessage(1, destinationDeviceId3, 1, "foo".getBytes(StandardCharsets.UTF_8))); |
436 | 436 |
|
437 | 437 | final ECKeyPair pniIdentityKeyPair = Curve.generateKeyPair();
|
438 | 438 | final ECPublicKey pniIdentityKey = pniIdentityKeyPair.getPublicKey();
|
@@ -469,8 +469,8 @@ void changeNumberMissingData() {
|
469 | 469 | final byte destinationDeviceId2 = 2;
|
470 | 470 | final byte destinationDeviceId3 = 3;
|
471 | 471 | final List<IncomingMessage> messages = List.of(
|
472 |
| - new IncomingMessage(1, destinationDeviceId2, 2, "foo"), |
473 |
| - new IncomingMessage(1, destinationDeviceId3, 3, "foo")); |
| 472 | + new IncomingMessage(1, destinationDeviceId2, 2, "foo".getBytes(StandardCharsets.UTF_8)), |
| 473 | + new IncomingMessage(1, destinationDeviceId3, 3, "foo".getBytes(StandardCharsets.UTF_8))); |
474 | 474 |
|
475 | 475 | final Map<Byte, Integer> registrationIds = Map.of((byte) 1, 17, destinationDeviceId2, 47, destinationDeviceId3, 89);
|
476 | 476 |
|
|
0 commit comments