@Test
public void testInstallBundle() throws Exception {

    Bundle bundle = Mockito.mock(Bundle.class);
    Mockito.when(context.installBundle("file:test.jar")).thenReturn(bundle);
    Mockito.when(bundle.getBundleId()).thenReturn(Long.valueOf(2));
    long bundleId = mbean.installBundle("file:test.jar");
    Assert.assertEquals(2, bundleId);
    Mockito.reset(context);
    Mockito.when(context.installBundle("file:test2.jar")).thenThrow(new BundleException("location doesn't exist"));
    try {
        mbean.installBundle("file:test2.jar");
        Assert.fail("Shouldn't go to this stage, location doesn't exist");
    } catch (IOException e) {
        // ok
    }
}