Loading tests/testables/src/android/testing/TestableResources.java +12 −0 Original line number Diff line number Diff line Loading @@ -15,9 +15,11 @@ package android.testing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.mockito.Mockito.withSettings; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.util.Log; import android.util.SparseArray; Loading Loading @@ -53,6 +55,16 @@ public class TestableResources { return mResources; } /** * Sets a configuration for {@link #getResources()} to return to allow custom configs to * be set and tested. * * @param configuration the configuration to return from resources. */ public void overrideConfiguration(Configuration configuration) { when(mResources.getConfiguration()).thenReturn(configuration); } /** * Sets the return value for the specified resource id. * <p> Loading Loading
tests/testables/src/android/testing/TestableResources.java +12 −0 Original line number Diff line number Diff line Loading @@ -15,9 +15,11 @@ package android.testing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.mockito.Mockito.withSettings; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.util.Log; import android.util.SparseArray; Loading Loading @@ -53,6 +55,16 @@ public class TestableResources { return mResources; } /** * Sets a configuration for {@link #getResources()} to return to allow custom configs to * be set and tested. * * @param configuration the configuration to return from resources. */ public void overrideConfiguration(Configuration configuration) { when(mResources.getConfiguration()).thenReturn(configuration); } /** * Sets the return value for the specified resource id. * <p> Loading