@Test(expected = StorageDriverNotFoundException.class) public void getUnexistingDriver() throws Exception { DriverManager.getDriverFor("test"); }
public static Driver getDriverFor(String offerId) throws StorageDriverNotFoundException { for (String driverName : drivers.keySet()) { final Driver driver = drivers.get(driverName); if (driver.hasOffer(offerId)) { return driver; } } LOGGER.error("No suitable driver for offer ID : " + offerId); throw new StorageDriverNotFoundException("No suitable driver for offer ID : " + offerId); }
DriverManager { public static Driver getDriverFor(String offerId) throws StorageDriverNotFoundException { for (String driverName : drivers.keySet()) { final Driver driver = drivers.get(driverName); if (driver.hasOffer(offerId)) { return driver; } } LOGGER.error("No suitable driver for offer ID : " + offerId); throw new StorageDriverNotFoundException("No suitable driver for offer ID : " + offerId); } }
DriverManager { public static Driver getDriverFor(String offerId) throws StorageDriverNotFoundException { for (String driverName : drivers.keySet()) { final Driver driver = drivers.get(driverName); if (driver.hasOffer(offerId)) { return driver; } } LOGGER.error("No suitable driver for offer ID : " + offerId); throw new StorageDriverNotFoundException("No suitable driver for offer ID : " + offerId); } private  DriverManager(); }
DriverManager { public static Driver getDriverFor(String offerId) throws StorageDriverNotFoundException { for (String driverName : drivers.keySet()) { final Driver driver = drivers.get(driverName); if (driver.hasOffer(offerId)) { return driver; } } LOGGER.error("No suitable driver for offer ID : " + offerId); throw new StorageDriverNotFoundException("No suitable driver for offer ID : " + offerId); } private  DriverManager(); static Driver addDriver(Driver driver); static void changeDriverMapper(DriverMapper newMapper); static void addOfferToDriver(String name, String offerId); static void addOffersToDriver(String name, List<String> offerIds); static void removeOffer(String offerId); static Driver getDriverFor(String offerId); }
DriverManager { public static Driver getDriverFor(String offerId) throws StorageDriverNotFoundException { for (String driverName : drivers.keySet()) { final Driver driver = drivers.get(driverName); if (driver.hasOffer(offerId)) { return driver; } } LOGGER.error("No suitable driver for offer ID : " + offerId); throw new StorageDriverNotFoundException("No suitable driver for offer ID : " + offerId); } private  DriverManager(); static Driver addDriver(Driver driver); static void changeDriverMapper(DriverMapper newMapper); static void addOfferToDriver(String name, String offerId); static void addOffersToDriver(String name, List<String> offerIds); static void removeOffer(String offerId); static Driver getDriverFor(String offerId);  }