@Test
public void testContribute() throws Exception {

  Addon addon = new Addon();
  LookAndFeelAddons.contribute(addon);
  // a ComponentAddon is initialized when it is contributed
  assertTrue(addon.initialized);
  // and uninitialized when "uncontributed"
  LookAndFeelAddons.uncontribute(addon);
  assertTrue(addon.uninitialized);
  // re-contribute the ComponentAddon
  LookAndFeelAddons.contribute(addon);
  // reset its state
  addon.initialized = false;
  addon.uninitialized = false;
  // when addon is changed, the ComponentAddon is uninitialized with the
  // previous addon, then initialized with the new
  LookAndFeelAddons oldLFAddon = LookAndFeelAddons.getAddon();
  LookAndFeelAddons.setAddon(MetalLookAndFeelAddons.class);
  LookAndFeelAddons newLFAddon = LookAndFeelAddons.getAddon();
  assertTrue(addon.uninitialized);
  assertEquals(oldLFAddon, addon.uninitializedWith);
  assertTrue(addon.initialized);
  assertEquals(newLFAddon, addon.initializedWith);
}