### Question:
Datasets { public static boolean exists(URI uri) { Preconditions.checkArgument( URIBuilder.DATASET_SCHEME.equals(uri.getScheme()), "Not a dataset URI: " + uri); Pair<DatasetRepository, Map<String, String>> pair = Registration.lookupDatasetUri(URI.create(uri.getRawSchemeSpecificPart())); DatasetRepository repo = pair.first(); Map<String, String> uriOptions = pair.second(); return repo.exists( uriOptions.get(URIBuilder.NAMESPACE_OPTION), uriOptions.get(URIBuilder.DATASET_NAME_OPTION)); }  @SuppressWarnings("unchecked") static V load(URI uri, Class<E> type); @SuppressWarnings("unchecked") static V load(URI uri); static V load(String uriString, Class<E> type); static V load(String uriString); @SuppressWarnings("unchecked") static V create(URI uri, DatasetDescriptor descriptor, Class<E> type); @SuppressWarnings("unchecked") static V create(URI uri, DatasetDescriptor descriptor); static V create(String uri, DatasetDescriptor descriptor, Class<E> type); @SuppressWarnings("unchecked") static V create(String uri, DatasetDescriptor descriptor); @SuppressWarnings("unchecked") static D update(
      URI uri, DatasetDescriptor descriptor, Class<E> type); @SuppressWarnings("unchecked") static D update(
      URI uri, DatasetDescriptor descriptor); static D update(String uri, DatasetDescriptor descriptor, Class<E> type); static D update(String uri, DatasetDescriptor descriptor); static boolean delete(URI uri); static boolean delete(String uri); static boolean moveToTrash(URI uri); static boolean moveToTrash(String uri); static boolean exists(URI uri); static boolean exists(String uri); static Collection<URI> list(URI uri); static Collection<URI> list(String uri);  }### Answer:
@Test public void testExists() { URI datasetUri = new URIBuilder(repoUri, "ns", "test").build(); when(repo.exists("ns", "test")).thenReturn(true); Assert.assertTrue(Datasets.exists(datasetUri)); verify(repo).exists("ns", "test"); verifyNoMoreInteractions(repo); }
@Test public void testExistsStringUri() { URI datasetUri = new URIBuilder(repoUri, "ns", "test").build(); when(repo.exists("ns", "test")).thenReturn(false); Assert.assertFalse(Datasets.exists(datasetUri.toString())); verify(repo).exists("ns", "test"); verifyNoMoreInteractions(repo); }
@Test public void testExistsRejectsViewUri() { final URI datasetUri = new URIBuilder(repoUri, "ns", "test") .with("field", 34) .build(); TestHelpers.assertThrows("Should reject view URI", IllegalArgumentException.class, new Runnable() { @Override public void run() { Datasets.exists(datasetUri); } }); verifyNoMoreInteractions(repo); }