@Test
public void testRefreshBundle() throws Exception {

    Bundle bundle = Mockito.mock(Bundle.class);
    Mockito.when(context.getBundle(1)).thenReturn(bundle);
    mbean.refreshBundle(1);
    Mockito.verify(admin).refreshPackages((Bundle[]) Mockito.any());
    try {
        mbean.refreshBundle(2);
        Assert.fail("IOException should be thrown");
    } catch (IOException e) {
        // expected
    }
}