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();  }
@Test public void testFactoryCreatesFileStorage() { assertTrue(StorageFactory.createStorage() instanceof FileStorage); }