### Question:
Drivers { public static Map<String,Object> parseURI(URI uri, Driver<?> d) { uri = convertFileURI(uri); Map<String,Object> opts = new HashMap<String, Object>(); String first = uri.getHost() != null ? uri.getHost() : uri.getPath(); if (!isEmptyOrNull(first)) { if (!d.keys().isEmpty()) { opts.put(d.keys().get(0).name(), first); } } if (!isEmptyOrNull(uri.getQuery())) { String[] kvps = uri.getQuery().split("&"); for (String kvp : kvps) { String[] kv = kvp.split("="); if (kv.length != 2) { throw new IllegalArgumentException("Illegal key value pair: " + kvp); } opts.put(kv[0], kv[1]); } } return opts; }  static Iterable<Driver<?>> list(); static Iterable<Driver<?>> list(DriverRegistry registry); static Iterable<Driver<?>> list(final Class<?> filter); static Iterable<Driver<?>> list(final Class<?> filter, DriverRegistry registry); static Driver<?> find(String name); static Driver<?> find(String name, DriverRegistry registry); static Driver<?> find(URI uri); static Driver<T> find(URI uri, DriverRegistry registry); static Object open(File file); static Object open(File file, DriverRegistry registry); static T open(File file, Class<T> clazz); static T open(File file, Class<T> clazz, DriverRegistry registry); static T open(Map<?, Object> opts); static T open(Map<?, Object> opts, Class<T> clazz); static T open(Map<?, Object> opts, Class<T> clazz, DriverRegistry registry); static Object open(URI uri); static Object open(URI uri, DriverRegistry registry); static T open(URI uri, Class<T> clazz); static T open(URI uri, Class<T> clazz, DriverRegistry registry); static T create(Schema schema, URI uri, Class<T> clazz); static T create(Schema schema, URI uri, Class<T> clazz, 
        DriverRegistry registry); static Map<String,Object> parseURI(URI uri, Driver<?> d); static final DriverRegistry REGISTRY; }### Answer:
@Test public void testParseURI() throws Exception { List<Key> keys = new ArrayList<>(); keys.add(new Key("foo", String.class)); keys.add(new Key("bar", Integer.class)); Driver d = createMock(Driver.class); expect(d.keys()).andReturn(keys).anyTimes(); replay(d); Map<String,Object> opts = Drivers.parseURI(new URI("x: assertTrue(opts.isEmpty()); opts = Drivers.parseURI(new URI("x: assertEquals(1, opts.size()); assertEquals("blah", opts.get("foo")); opts = Drivers.parseURI(new URI("x: assertEquals(3, opts.size()); assertEquals("blah", opts.get("foo")); assertEquals("bam!", opts.get("bar")); assertEquals("y", opts.get("x")); }