@Test
@SuppressWarnings({ "unchecked", "rawtypes" })

public void testInstallBackgroundPainter() {
    Painter plafPainter = new PainterUIResource(null);
    UIManager.put("test.painter", plafPainter);
    
    BackgroundPainterTestingComponent panel = new BackgroundPainterTestingComponent();
    //overwrite null painter
    LookAndFeelAddons.installBackgroundPainter(panel, "test.painter");
    
    assertThat(panel.getBackgroundPainter(), is(sameInstance(plafPainter)));
    
    panel.setBackgroundPainter(new PainterUIResource(null));
    
    //overwrite uiresource painter
    LookAndFeelAddons.installBackgroundPainter(panel, "test.painter");
    
    assertThat(panel.getBackgroundPainter(), is(sameInstance(plafPainter)));
    
    Painter userPainter = new MattePainter();
    panel.setBackgroundPainter(userPainter);
    
    //do not overwrite user painter
    LookAndFeelAddons.installBackgroundPainter(panel, "test.painter");
    
    assertThat(panel.getBackgroundPainter(), is(sameInstance(userPainter)));
}