AmbariFactory implements SoftwareManagerFactory { @Override public SoftwareManager getSoftwareManager(String URL, String username, char[] password, String certificate) { URL url = null; try { url = new URL(URL); } catch (MalformedURLException e) { logger.warn("AmbariFactory:: Url parse error: " + e.getMessage()); } if (url == null || CommonUtil.isBlank(url.getHost())) { String msg = "The format of URL " + URL + "is invalid."; logger.warn(msg); throw new BddException(null, "SOFT_MANAGER", "INVALID_URL", msg); } return new AmbariImpl(url, username, new String(password), certificate); }  @Override SoftwareManager getSoftwareManager(String URL, String username,
         char[] password, String certificate);  }
@Test public void testGetSoftwareManager() { Mockit.setUpMock(MockAmbariManagerClientbuilder.class); Mockit.setUpMock(MockApiManager.class); apiRootResource = Mockito.mock(ApiRootResource.class); SoftwareManagerFactory softwareManagerFactory = new AmbariFactory(); AmbariImpl softwareManager = (AmbariImpl) softwareManagerFactory.getSoftwareManager( "http: Assert.assertEquals(Constants.AMBARI_PLUGIN_NAME, softwareManager.getName()); }