@Test
public void testStopBundle() throws Exception {

    Bundle bundle = Mockito.mock(Bundle.class);
    Mockito.when(context.getBundle(5)).thenReturn(bundle);
    mbean.stopBundle(5);
    Mockito.verify(bundle).stop();
    Mockito.when(context.getBundle(5)).thenReturn(null);
    try {
        mbean.stopBundle(5);
        Assert.fail("IOException should be thrown");
    } catch (IOException e) {
        //expected
    }
}