diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDocumentsProviderTest.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDocumentsProviderTest.java index 0c03814cc4e8e..5765f0a905019 100644 --- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDocumentsProviderTest.java +++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDocumentsProviderTest.java @@ -16,9 +16,6 @@ package com.android.mtp; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.content.res.Resources.NotFoundException; import android.database.Cursor; import android.mtp.MtpConstants; import android.mtp.MtpObjectInfo; @@ -26,7 +23,6 @@ import android.net.Uri; import android.provider.DocumentsContract.Root; import android.provider.DocumentsContract; import android.test.AndroidTestCase; -import android.test.mock.MockResources; import android.test.suitebuilder.annotation.SmallTest; import java.io.FileNotFoundException; @@ -39,16 +35,7 @@ public class MtpDocumentsProviderTest extends AndroidTestCase { private TestContentResolver mResolver; private MtpDocumentsProvider mProvider; private TestMtpManager mMtpManager; - private final MockResources mResources = new MockResources() { - @Override - public String getString(int id) throws NotFoundException { - switch (id) { - case R.string.root_name: - return "%1$s %2$s"; - } - throw new NotFoundException(); - } - }; + private final TestResources mResources = new TestResources(); @Override public void setUp() throws IOException { diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResources.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResources.java new file mode 100644 index 0000000000000..eb80e3b60e6a5 --- /dev/null +++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResources.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.mtp; + +import android.test.mock.MockResources; + +class TestResources extends MockResources { + @Override + public String getString(int id) throws NotFoundException { + switch (id) { + case R.string.root_name: + return "%1$s %2$s"; + } + throw new NotFoundException(); + } +}