Code example for Configuration

0
    @Test 
    public void testGetAndSetConfiguration_SameInstance() throws Exception { 
        Activity activity = new Activity();
        Resources resources = activity.getResources();
        assertSame(resources.getConfiguration(), resources.getConfiguration());
        Configuration diffConfig = new Configuration();
        shadowOf(resources).setConfiguration(diffConfig);
        assertSame(diffConfig, resources.getConfiguration());
    } 
 
    @Test(expected = Resources.NotFoundException.class) 
    public void testGetDrawableNullRClass() throws Exception { 
        ResourceLoader resourceLoader = new EmptyResourceLoader();
        resources = new Resources(null, null, null);
        ShadowResources.bind(resources, resourceLoader);
 
        assertThat(resources.getDrawable(-12345)).isInstanceOf(BitmapDrawable.class);
    } 
 
    /** 
     * given an R.anim.id value, will return an AnimationDrawable