ResourceValueProvider extends AbstractValueProvider { public String getPropertyValue(final Property property) { if (context == null || property == null) { return null; } return context.getResources().getString(property.getResourceId()); } ResourceValueProvider(final Context context); String getPropertyValue(final Property property);  }
@Test public void get_ctxIsNull() { final Property p = Property.MAP_PROVIDER_SCHEMA; assertNull(new ResourceValueProvider(null).getPropertyValue(p)); }
@Test public void get_null() { assertNull(toTest.getPropertyValue(null)); }
@Test public void get() { Resources mockResources = mock(Resources.class); doAnswer(new Answer<String>() { public String answer(InvocationOnMock invocation) throws Throwable { return String.valueOf(invocation.getArguments()[0]); } }).when(mockResources).getString(anyInt()); doReturn(mockResources).when(mockContext).getResources(); final Property p = Property.MAP_PROVIDER_SCHEMA; assertEquals(String.valueOf(p.getResourceId()), toTest.getPropertyValue(p)); }