@Test(expected = IllegalArgumentException.class) public void willThrowAnExceptionWhenTryingToGetSpecificVersionMapForInvalidContext() { DriverMap driverMap = new DriverMap(); driverMap.getDetailsForVersionOfDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT), "4"); }
public DriverDetails getDetailsForVersionOfDriverContext(DriverContext driverContext, String version) throws IllegalArgumentException { if (!repository.containsKey(driverContext)) { throw new IllegalArgumentException("Driver context not found in driver repository"); } TreeMap<String, DriverDetails> driverVersions = repository.get(driverContext); DriverDetails detailsToReturn = driverVersions.get(driverVersions.lastKey()); if (detailsToReturn.hashCode() == 0) { throw new NoSuchElementException("No driver version " + version + " exists for the context " + driverContext.toString()); } return detailsToReturn; }
DriverMap { public DriverDetails getDetailsForVersionOfDriverContext(DriverContext driverContext, String version) throws IllegalArgumentException { if (!repository.containsKey(driverContext)) { throw new IllegalArgumentException("Driver context not found in driver repository"); } TreeMap<String, DriverDetails> driverVersions = repository.get(driverContext); DriverDetails detailsToReturn = driverVersions.get(driverVersions.lastKey()); if (detailsToReturn.hashCode() == 0) { throw new NoSuchElementException("No driver version " + version + " exists for the context " + driverContext.toString()); } return detailsToReturn; } }
DriverMap { public DriverDetails getDetailsForVersionOfDriverContext(DriverContext driverContext, String version) throws IllegalArgumentException { if (!repository.containsKey(driverContext)) { throw new IllegalArgumentException("Driver context not found in driver repository"); } TreeMap<String, DriverDetails> driverVersions = repository.get(driverContext); DriverDetails detailsToReturn = driverVersions.get(driverVersions.lastKey()); if (detailsToReturn.hashCode() == 0) { throw new NoSuchElementException("No driver version " + version + " exists for the context " + driverContext.toString()); } return detailsToReturn; }  }
DriverMap { public DriverDetails getDetailsForVersionOfDriverContext(DriverContext driverContext, String version) throws IllegalArgumentException { if (!repository.containsKey(driverContext)) { throw new IllegalArgumentException("Driver context not found in driver repository"); } TreeMap<String, DriverDetails> driverVersions = repository.get(driverContext); DriverDetails detailsToReturn = driverVersions.get(driverVersions.lastKey()); if (detailsToReturn.hashCode() == 0) { throw new NoSuchElementException("No driver version " + version + " exists for the context " + driverContext.toString()); } return detailsToReturn; }  TreeMap<String, DriverDetails> getMapForDriverContext(DriverContext driverContext); DriverDetails getDetailsForVersionOfDriverContext(DriverContext driverContext, String version); DriverDetails getDetailsForLatestVersionOfDriverContext(DriverContext driverContext); Set<DriverContext> getKeys(); Set<String> getAvailableVersionsForDriverContext(DriverContext driverContext); ArrayList<DriverContext> getDriverContextsForOperatingSystem(OperatingSystem operatingSystem, SystemArchitecture systemArchitecture); ArrayList<DriverContext> getDriverContextsForCurrentOperatingSystem(); }
DriverMap { public DriverDetails getDetailsForVersionOfDriverContext(DriverContext driverContext, String version) throws IllegalArgumentException { if (!repository.containsKey(driverContext)) { throw new IllegalArgumentException("Driver context not found in driver repository"); } TreeMap<String, DriverDetails> driverVersions = repository.get(driverContext); DriverDetails detailsToReturn = driverVersions.get(driverVersions.lastKey()); if (detailsToReturn.hashCode() == 0) { throw new NoSuchElementException("No driver version " + version + " exists for the context " + driverContext.toString()); } return detailsToReturn; }  TreeMap<String, DriverDetails> getMapForDriverContext(DriverContext driverContext); DriverDetails getDetailsForVersionOfDriverContext(DriverContext driverContext, String version); DriverDetails getDetailsForLatestVersionOfDriverContext(DriverContext driverContext); Set<DriverContext> getKeys(); Set<String> getAvailableVersionsForDriverContext(DriverContext driverContext); ArrayList<DriverContext> getDriverContextsForOperatingSystem(OperatingSystem operatingSystem, SystemArchitecture systemArchitecture); ArrayList<DriverContext> getDriverContextsForCurrentOperatingSystem();  }