Steve McKay | c8889af | 2016-09-23 11:22:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Steve McKay | b6006b2 | 2016-09-29 09:23:45 -0700 | [diff] [blame] | 17 | package com.android.documentsui.files; |
| 18 | |
Tony Huang | cf74715 | 2019-11-18 13:43:41 +0800 | [diff] [blame] | 19 | import com.android.documentsui.AbstractActionHandler; |
Garfield Tan | e967033 | 2017-03-06 18:33:23 -0800 | [diff] [blame] | 20 | import com.android.documentsui.testing.TestEnv; |
Steve McKay | c8889af | 2016-09-23 11:22:41 -0700 | [diff] [blame] | 21 | |
Steve McKay | c8889af | 2016-09-23 11:22:41 -0700 | [diff] [blame] | 22 | import org.mockito.Mockito; |
| 23 | |
Steve McKay | 988d8a3 | 2016-09-27 09:41:17 -0700 | [diff] [blame] | 24 | public abstract class TestActivity extends AbstractBase { |
Steve McKay | c8889af | 2016-09-23 11:22:41 -0700 | [diff] [blame] | 25 | |
Garfield Tan | e967033 | 2017-03-06 18:33:23 -0800 | [diff] [blame] | 26 | public static TestActivity create(TestEnv env) { |
Steve McKay | 988d8a3 | 2016-09-27 09:41:17 -0700 | [diff] [blame] | 27 | TestActivity activity = Mockito.mock(TestActivity.class, Mockito.CALLS_REAL_METHODS); |
Garfield Tan | e967033 | 2017-03-06 18:33:23 -0800 | [diff] [blame] | 28 | activity.init(env); |
Steve McKay | 988d8a3 | 2016-09-27 09:41:17 -0700 | [diff] [blame] | 29 | return activity; |
Steve McKay | c8889af | 2016-09-23 11:22:41 -0700 | [diff] [blame] | 30 | } |
| 31 | } |
Steve McKay | 988d8a3 | 2016-09-27 09:41:17 -0700 | [diff] [blame] | 32 | |
| 33 | // Trick Mockito into finding our Addons methods correctly. W/o this |
| 34 | // hack, Mockito thinks Addons methods are not implemented. |
| 35 | abstract class AbstractBase extends com.android.documentsui.TestActivity |
Tony Huang | cf74715 | 2019-11-18 13:43:41 +0800 | [diff] [blame] | 36 | implements AbstractActionHandler.CommonAddons {} |