HidableTabbedPane extends JPanel { public void setSelectedIndex(int index) { tabs.setSelectedIndex(index); } HidableTabbedPane();  HidableTabbedPane(String firstTabTitle, Component firstComponent); int getTabCount(); int getSelectedIndex(); void setSelectedIndex(int index); Component getComponentAt(int index); Component getTabComponentAt(int index); void setComponentAt(int index, Component component); void setTabComponentAt(int index, Component component); boolean isTabsShown(); void addTab(String title, Component component); void removeTabAt(int index); void addChangeListener(ChangeListener listener);  }
@Test(expectedExceptions={IndexOutOfBoundsException.class}) public void testIndexTooLow() { JLabel one = new JLabel("One"); HidableTabbedPane h = new HidableTabbedPane("Tab One", one); h.setSelectedIndex(-2); }
@Test(expectedExceptions={IndexOutOfBoundsException.class}) public void testIndexTooHigh() { JLabel one = new JLabel("One"); HidableTabbedPane h = new HidableTabbedPane("Tab One", one); h.setSelectedIndex(1); }