PermissionAdmin implements PermissionAdminMBean { public String[] listLocations() throws IOException { return permAdmin.getLocations(); } PermissionAdmin(org.osgi.service.permissionadmin.PermissionAdmin permAdmin); String[] getPermissions(String location); String[] listDefaultPermissions(); String[] listLocations(); void setDefaultPermissions(String[] encodedPermissions); void setPermissions(String location, String[] encodedPermissions);  }
@Test public void testListLocations() throws IOException { String[] locations1 = new String[] { "test1", "test2" }; Mockito.when(permAdmin.getLocations()).thenReturn(locations1); String[] locations2 = mbean.listLocations(); Assert.assertNotNull(locations2); Assert.assertEquals(2, locations2.length); Assert.assertSame(locations1, locations2); }