Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3785fae

Browse files
committed
format
1 parent 1a76013 commit 3785fae

1 file changed

Lines changed: 19 additions & 24 deletions

File tree

shell/platform/android/test/io/flutter/embedding/engine/systemchannels/RestorationChannelTest.java

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,19 @@
44
import static org.mockito.Mockito.any;
55
import static org.mockito.Mockito.eq;
66
import static org.mockito.Mockito.mock;
7-
import static org.mockito.Mockito.spy;
87
import static org.mockito.Mockito.times;
98
import static org.mockito.Mockito.verify;
109
import static org.mockito.Mockito.verifyZeroInteractions;
1110

1211
import android.annotation.TargetApi;
13-
import android.view.PointerIcon;
14-
import io.flutter.embedding.android.FlutterView;
15-
import io.flutter.embedding.engine.dart.DartExecutor;
16-
import io.flutter.embedding.engine.systemchannels.RestorationChannel;
1712
import io.flutter.plugin.common.MethodCall;
1813
import io.flutter.plugin.common.MethodChannel;
19-
import java.util.HashMap;
2014
import org.json.JSONException;
2115
import org.junit.Test;
2216
import org.junit.runner.RunWith;
17+
import org.mockito.ArgumentCaptor;
2318
import org.robolectric.RobolectricTestRunner;
24-
import org.robolectric.RuntimeEnvironment;
2519
import org.robolectric.annotation.Config;
26-
import android.support.annotation.NonNull;
27-
import io.flutter.Log;
28-
import io.flutter.embedding.engine.dart.DartExecutor;
29-
import io.flutter.plugin.common.MethodCall;
30-
import io.flutter.plugin.common.MethodChannel;
31-
import io.flutter.plugin.common.StandardMethodCodec;
32-
import org.mockito.ArgumentCaptor;
3320

3421
@Config(
3522
manifest = Config.NONE,
@@ -38,9 +25,11 @@
3825
@TargetApi(24)
3926
public class RestorationChannelTest {
4027
@Test
41-
public void itDoesNotDoAnythingWhenRestorationDataIsSetBeforeFrameworkAsks() throws JSONException {
28+
public void itDoesNotDoAnythingWhenRestorationDataIsSetBeforeFrameworkAsks()
29+
throws JSONException {
4230
MethodChannel rawChannel = mock(MethodChannel.class);
43-
RestorationChannel restorationChannel = new RestorationChannel(rawChannel, /*waitForRestorationData=*/ false);
31+
RestorationChannel restorationChannel =
32+
new RestorationChannel(rawChannel, /*waitForRestorationData=*/ false);
4433
restorationChannel.setRestorationData("Any String you want".getBytes());
4534
verify(rawChannel, times(0)).invokeMethod(any(), any());
4635
}
@@ -50,8 +39,10 @@ public void itSendsDataOverWhenRequestIsPending() throws JSONException {
5039
byte[] data = "Any String you want".getBytes();
5140

5241
MethodChannel rawChannel = mock(MethodChannel.class);
53-
RestorationChannel restorationChannel = new RestorationChannel(rawChannel, /*waitForRestorationData=*/ true);
54-
ArgumentCaptor<MethodChannel.MethodCallHandler> argumentCaptor = ArgumentCaptor.forClass(MethodChannel.MethodCallHandler.class);
42+
RestorationChannel restorationChannel =
43+
new RestorationChannel(rawChannel, /*waitForRestorationData=*/ true);
44+
ArgumentCaptor<MethodChannel.MethodCallHandler> argumentCaptor =
45+
ArgumentCaptor.forClass(MethodChannel.MethodCallHandler.class);
5546
verify(rawChannel).setMethodCallHandler(argumentCaptor.capture());
5647

5748
MethodChannel.Result result = mock(MethodChannel.Result.class);
@@ -73,8 +64,10 @@ public void itPushesNewData() throws JSONException {
7364
byte[] data = "Any String you want".getBytes();
7465

7566
MethodChannel rawChannel = mock(MethodChannel.class);
76-
RestorationChannel restorationChannel = new RestorationChannel(rawChannel, /*waitForRestorationData=*/ false);
77-
ArgumentCaptor<MethodChannel.MethodCallHandler> argumentCaptor = ArgumentCaptor.forClass(MethodChannel.MethodCallHandler.class);
67+
RestorationChannel restorationChannel =
68+
new RestorationChannel(rawChannel, /*waitForRestorationData=*/ false);
69+
ArgumentCaptor<MethodChannel.MethodCallHandler> argumentCaptor =
70+
ArgumentCaptor.forClass(MethodChannel.MethodCallHandler.class);
7871
verify(rawChannel).setMethodCallHandler(argumentCaptor.capture());
7972

8073
MethodChannel.Result result = mock(MethodChannel.Result.class);
@@ -84,7 +77,8 @@ public void itPushesNewData() throws JSONException {
8477
restorationChannel.setRestorationData(data);
8578
assertEquals(restorationChannel.getRestorationData(), null);
8679

87-
ArgumentCaptor<MethodChannel.Result> resultCapture = ArgumentCaptor.forClass(MethodChannel.Result.class);
80+
ArgumentCaptor<MethodChannel.Result> resultCapture =
81+
ArgumentCaptor.forClass(MethodChannel.Result.class);
8882
verify(rawChannel).invokeMethod(eq("push"), eq(data), resultCapture.capture());
8983
resultCapture.getValue().success(null);
9084
assertEquals(restorationChannel.getRestorationData(), data);
@@ -95,13 +89,14 @@ public void itHoldsOnToDataFromFramework() throws JSONException {
9589
byte[] data = "Any String you want".getBytes();
9690

9791
MethodChannel rawChannel = mock(MethodChannel.class);
98-
RestorationChannel restorationChannel = new RestorationChannel(rawChannel, /*waitForRestorationData=*/ false);
99-
ArgumentCaptor<MethodChannel.MethodCallHandler> argumentCaptor = ArgumentCaptor.forClass(MethodChannel.MethodCallHandler.class);
92+
RestorationChannel restorationChannel =
93+
new RestorationChannel(rawChannel, /*waitForRestorationData=*/ false);
94+
ArgumentCaptor<MethodChannel.MethodCallHandler> argumentCaptor =
95+
ArgumentCaptor.forClass(MethodChannel.MethodCallHandler.class);
10096
verify(rawChannel).setMethodCallHandler(argumentCaptor.capture());
10197

10298
MethodChannel.Result result = mock(MethodChannel.Result.class);
10399
argumentCaptor.getValue().onMethodCall(new MethodCall("put", data), result);
104100
assertEquals(restorationChannel.getRestorationData(), data);
105101
}
106102
}
107-

0 commit comments

Comments
 (0)