### Question:
OsgiUtil { public static Object getBean(Object beanFactory, String beanId) { try { Method getBeanMethod = beanFactory.getClass().getMethod("getBean", String.class); return getBeanMethod.invoke(beanFactory, beanId); } catch (Exception ex) { LOG.error("Unable to call getBean() on object of type [{}], with bean id [{}]", beanFactory.getClass().getName(), beanId, ex); } return null; }  static URL translateBundleURLToJarURL(URL bundleUrl, Bundle bundle); static Object getBean(Object beanFactory, String beanId); static boolean containsBean(Object beanFactory, String beanId); static String generateJavaVersionForSystemPackages(String systemJavaVersion); static String generateJava_SE_SystemPackageVersionString(String systemJavaVersion);  }### Answer:
@Test public void testGetBean() { MockBeanFactory mockBeanFactory = new MockBeanFactory(); Object mockBean = OsgiUtil.getBean(mockBeanFactory, "1000"); Assert.assertNotNull("OsgiUtil getBean() on mock bean factory returned null ?", mockBean); Assert.assertTrue("Mock bean from mock bean factory has mismatched id ?", mockBeanFactory.beanMatchesId(mockBean, "1000")); mockBean = OsgiUtil.getBean(new Object(), "1000"); Assert.assertNull("OsgiUtil getBean() on normal object found a getBean() method ?", mockBean); }