@Test
  public void testThatCellRendererIsSet() {
    final JTree jTree = new JTree();
    final TreeCellRenderer renderer1 = jTree.getCellRenderer();
    assertNotNull(renderer1);
    assertEquals(true, renderer1 instanceof DefaultTreeCellRenderer);

    CatalogTreeUtils.addCellRenderer(jTree);

    final TreeCellRenderer renderer2 = jTree.getCellRenderer();
    assertNotNull(renderer2);
    assertEquals(true, renderer2 instanceof DefaultTreeCellRenderer);
    assertNotSame(renderer1, renderer2);
  }
  @Test
  public void testThatRendererRendersDifferentTypes() {
    final JTree jTree = new JTree();
    CatalogTreeUtils.addCellRenderer(jTree);
    final TreeCellRenderer dapCellRenderer = jTree.getCellRenderer();

    final OpendapLeaf opendapLeaf =
        new OpendapLeaf("This is A dap Node", new InvDataset(null, "") {});
    opendapLeaf.setDapAccess(true);
    final OpendapLeaf fileLeaf =
        new OpendapLeaf("This is A File Node", new InvDataset(null, "") {});
    fileLeaf.setFileAccess(true);
    final Object dapNode = new DefaultMutableTreeNode(opendapLeaf);
    final Object fileNode = new DefaultMutableTreeNode(fileLeaf);
    final Object noDapNode = new DefaultMutableTreeNode("otherNode");

    final Component component =
        dapCellRenderer.getTreeCellRendererComponent(
            jTree, noDapNode, false, false, true, 0, false);

    assertEquals(true, component instanceof DefaultTreeCellRenderer);
    final DefaultTreeCellRenderer tcr1 = (DefaultTreeCellRenderer) component;
    assertEquals("otherNode", tcr1.getText());
    assertEquals(true, tcr1.getIcon() instanceof ImageIcon);

    final Color foreground = tcr1.getForeground();
    final Color background = tcr1.getBackground();
    final Font font = tcr1.getFont();

    final Component component2 =
        dapCellRenderer.getTreeCellRendererComponent(jTree, dapNode, false, false, true, 0, false);

    assertSame(component, component2);

    assertEquals(true, component2 instanceof DefaultTreeCellRenderer);
    final DefaultTreeCellRenderer tcr2 = (DefaultTreeCellRenderer) component2;
    assertEquals("This is A dap Node", tcr2.getText());
    assertEquals(true, tcr2.getIcon() instanceof ImageIcon);
    final ImageIcon icon2 = (ImageIcon) tcr2.getIcon();
    // todo change the expected icon to a realistic icon
    assertEquals(
        "/DRsProduct16.png",
        icon2.getDescription().substring(icon2.getDescription().lastIndexOf("/")));

    assertEquals(foreground, tcr2.getForeground());
    assertEquals(background, tcr2.getBackground());
    assertEquals(font, tcr2.getFont());

    final Component component3 =
        dapCellRenderer.getTreeCellRendererComponent(jTree, fileNode, false, false, true, 0, false);

    assertSame(component, component3);

    assertEquals(true, component3 instanceof DefaultTreeCellRenderer);
    final DefaultTreeCellRenderer tcr3 = (DefaultTreeCellRenderer) component3;
    assertEquals("This is A File Node", tcr3.getText());
    assertEquals(true, tcr3.getIcon() instanceof ImageIcon);
    final ImageIcon icon3 = (ImageIcon) tcr3.getIcon();
    // todo change the expected icon to a realistic icon
    assertEquals(
        "/FRsProduct16.png",
        icon3.getDescription().substring(icon3.getDescription().lastIndexOf("/")));

    assertEquals(foreground, tcr3.getForeground());
    assertEquals(background, tcr3.getBackground());
    assertEquals(font, tcr3.getFont());
  }