DefaultStringResourceProvider implements IStringResourceProvider { @Override public String getStringFromResource(@StringRes final int stringRes) { return mContext.getString(stringRes); } DefaultStringResourceProvider(final Context context); @Override String getStringFromResource(@StringRes final int stringRes); @Override String getStringFromResource(@StringRes final int stringResId, final Object... formatArgs);  }
@Test public void getStringFromResourceTest() throws Exception { when(mMockContext.getString(MOCKED_STRING_RES)).thenReturn(MOCKED_STRING); assert (mStringResourceProvider.getStringFromResource(MOCKED_STRING_RES).equals(MOCKED_STRING)); verify(mMockContext, times(1)).getString(anyInt()); verifyNoMoreInteractions(mMockContext); }
@Test public void getStringFromResourceWithArgsTest() throws Exception { when(mMockContext.getString(MOCKED_STRING_RES, MOCK_TEST)).thenReturn(MOCKED_STRING); assert (mStringResourceProvider.getStringFromResource(MOCKED_STRING_RES, MOCK_TEST).equals(MOCKED_STRING)); verify(mMockContext, times(1)).getString(anyInt(), Matchers.any()); verifyNoMoreInteractions(mMockContext); }