SourceProductSelector { public void setSelectedIndex(int index) { productListModel.setSelectedItem(productListModel.getElementAt(index)); } SourceProductSelector(AppContext appContext);  SourceProductSelector(AppContext appContext, String labelText); ProductFilter getProductFilter(); void setProductFilter(ProductFilter productFilter); synchronized void initProducts(); int getProductCount(); void setSelectedIndex(int index); Product getSelectedProduct(); void setCurrentDirectory(File directory); File getCurrentDirectory(); void setSelectedProduct(Product product); synchronized void releaseProducts(); void addSelectionChangeListener(SelectionChangeListener listener); void removeSelectionChangeListener(SelectionChangeListener listener); JComboBox<Object> getProductNameComboBox(); JLabel getProductNameLabel(); JButton getProductFileChooserButton(); JPanel createDefaultPanel();  }
@Test public void testSetSelectedIndex() throws Exception { SourceProductSelector selector = new SourceProductSelector(appContext, "Source"); selector.initProducts(); Assert.assertSame(defaultProducts[0], selector.getSelectedProduct()); selector.setSelectedIndex(1); Assert.assertSame(defaultProducts[1], selector.getSelectedProduct()); selector.setSelectedIndex(2); Assert.assertSame(defaultProducts[2], selector.getSelectedProduct()); }