### Question:
StringResource { static String getStringResourceByName(String name) { int id = ((AndroidApplication) Gdx.app).getResources().getIdentifier(name, "string", ((AndroidApplication) Gdx.app).getPackageName()); return ((AndroidApplication) Gdx.app).getResources().getString(id); } private  StringResource();   }### Answer:
@Test public void getStringResourceByName() { Resources resources = Mockito.mock(Resources.class); String name = "test"; Mockito.when(((AndroidApplication) Gdx.app).getResources()).thenReturn(resources); Mockito.when(resources.getString(Mockito.anyInt())).thenReturn("test_return"); String result = StringResource.getStringResourceByName(name); Assert.assertEquals("test_return", result); }