1package io.flutter.embedding.engine.systemchannels;
3import static org.junit.Assert.assertEquals;
4import static org.mockito.ArgumentMatchers.refEq;
5import static org.mockito.Mockito.doNothing;
6import static org.mockito.Mockito.mock;
7import static org.mockito.Mockito.verify;
8import static org.mockito.Mockito.when;
10import android.content.res.AssetManager;
11import androidx.test.ext.junit.runners.AndroidJUnit4;
12import io.flutter.embedding.engine.FlutterJNI;
13import io.flutter.embedding.engine.dart.DartExecutor;
14import io.flutter.plugin.common.MethodCall;
15import io.flutter.plugin.common.MethodChannel;
16import org.json.JSONException;
17import org.json.JSONObject;
19import org.junit.runner.RunWith;
20import org.mockito.ArgumentCaptor;
21import org.robolectric.annotation.Config;
24@RunWith(AndroidJUnit4.class)
32 PlatformChannel.PlatformMessageHandler mockMessageHandler =
35 Boolean returnValue =
true;
36 when(mockMessageHandler.clipboardHasStrings()).thenReturn(returnValue);
41 JSONObject expected =
new JSONObject();
43 expected.put(
"value", returnValue);
44 }
catch (JSONException
e) {
46 verify(mockResult).success(refEq(expected));
55 PlatformChannel.PlatformMessageHandler mockMessageHandler =
59 ArgumentCaptor<String> valueCapture = ArgumentCaptor.forClass(String.class);
60 doNothing().when(mockMessageHandler).share(valueCapture.capture());
62 final String expectedContent =
"Flutter";
67 assertEquals(valueCapture.getValue(), expectedContent);
68 verify(mockResult).success(
null);