24 {
25 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
26 DartExecutor dartExecutor = new DartExecutor(mockFlutterJNI, mock(AssetManager.class));
27 String channel = "flutter/test";
28 MethodChannel rawChannel = new MethodChannel(dartExecutor, channel);
29
30 int newSize = 3;
31 rawChannel.resizeChannelBuffer(newSize);
32
33
34
35
36 final byte[] expected = {
37 7, 6, 114, 101, 115, 105, 122, 101, 12, 2, 7, 12, 102, 108, 117, 116, 116, 101, 114, 47, 116,
38 101, 115, 116, 3, 3, 0, 0, 0
39 };
40
41
42 ArgumentMatcher<ByteBuffer> packetMatcher =
43 new ByteBufferContentMatcher(ByteBuffer.wrap(expected));
44 verify(mockFlutterJNI,
times(1))
45 .dispatchPlatformMessage(
46 eq(BasicMessageChannel.CHANNEL_BUFFERS_CHANNEL),
47 argThat(packetMatcher),
48 anyInt(),
49 anyInt());
50 }