@Test public void testFactoryCreatesFileStorage() { assertTrue(StorageFactory.createStorage() instanceof FileStorage); }
public static Storage createStorage() { LOGGER.debug("createStorage"); try { final EcmService ecmService = (EcmService) new InitialContext().lookup("java:comp/env/EcmService"); LOGGER.debug("createStorage: using ECMStorage"); return new EcmStorage(ecmService); } catch (final NamingException e) { LOGGER.error("createStorage: failed to lookup EcmService, using FileStorage instead", e); return new FileStorage(); } }
StorageFactory { public static Storage createStorage() { LOGGER.debug("createStorage"); try { final EcmService ecmService = (EcmService) new InitialContext().lookup("java:comp/env/EcmService"); LOGGER.debug("createStorage: using ECMStorage"); return new EcmStorage(ecmService); } catch (final NamingException e) { LOGGER.error("createStorage: failed to lookup EcmService, using FileStorage instead", e); return new FileStorage(); } } }
StorageFactory { public static Storage createStorage() { LOGGER.debug("createStorage"); try { final EcmService ecmService = (EcmService) new InitialContext().lookup("java:comp/env/EcmService"); LOGGER.debug("createStorage: using ECMStorage"); return new EcmStorage(ecmService); } catch (final NamingException e) { LOGGER.error("createStorage: failed to lookup EcmService, using FileStorage instead", e); return new FileStorage(); } }  }
StorageFactory { public static Storage createStorage() { LOGGER.debug("createStorage"); try { final EcmService ecmService = (EcmService) new InitialContext().lookup("java:comp/env/EcmService"); LOGGER.debug("createStorage: using ECMStorage"); return new EcmStorage(ecmService); } catch (final NamingException e) { LOGGER.error("createStorage: failed to lookup EcmService, using FileStorage instead", e); return new FileStorage(); } }  static Storage createStorage(); }
StorageFactory { public static Storage createStorage() { LOGGER.debug("createStorage"); try { final EcmService ecmService = (EcmService) new InitialContext().lookup("java:comp/env/EcmService"); LOGGER.debug("createStorage: using ECMStorage"); return new EcmStorage(ecmService); } catch (final NamingException e) { LOGGER.error("createStorage: failed to lookup EcmService, using FileStorage instead", e); return new FileStorage(); } }  static Storage createStorage();  }