### Question:
FileSystemDataset extends AbstractDataset<E> implements
    Mergeable<FileSystemDataset<E>>, InputFormatAccessor<E>, LastModifiedAccessor,
    PartitionedDataset<E>, SizeAccessor, Signalable<E>, Replaceable<View<E>> { @Override @SuppressWarnings("deprecation") public void dropPartition(PartitionKey key) { Preconditions.checkState(descriptor.isPartitioned(), "Attempt to drop a partition on a non-partitioned dataset (name:%s)", name); Preconditions.checkNotNull(key, "Partition key may not be null"); LOG.debug("Dropping partition with key:{} dataset:{}", key, name); Path partitionDirectory = toDirectoryName(directory, key); try { if (!fileSystem.delete(partitionDirectory, true)) { throw new IOException("Partition directory " + partitionDirectory + " for key " + key + " does not exist"); } } catch (IOException e) { throw new DatasetIOException("Unable to locate or drop dataset partition directory " + partitionDirectory, e); } } FileSystemDataset(FileSystem fileSystem, Path directory,
                    String namespace, String name,
                    DatasetDescriptor descriptor, URI uri,
                    @Nullable PartitionListener partitionListener,
                    Class<E> type);   FileSystemDataset(FileSystem fileSystem, Path directory,
                    String namespace, String name,
                    DatasetDescriptor descriptor, URI uri,
                    @Nullable PartitionKey partitionKey,
                    @Nullable PartitionListener partitionListener,
                    Class<E> type); private  FileSystemDataset(FileSystemDataset<?> toCopy, Class<E> type); @Override @SuppressWarnings("unchecked") Dataset<T> asType(Class<T> type); @Override URI getUri(); String getNamespace(); @Override String getName(); @Override DatasetDescriptor getDescriptor(); @Override Iterable<PartitionView<E>> getCoveringPartitions(); boolean deleteAll(); @Override boolean moveToTrash(); PathIterator pathIterator(); Iterator<Path> dirIterator(); @Override FileSystemView<E> filter(Constraints c); @Override @Nullable @SuppressWarnings("deprecation") PartitionedDataset<E> getPartition(PartitionKey key, boolean allowCreate); @Override @SuppressWarnings("deprecation") void dropPartition(PartitionKey key); @Override @SuppressWarnings("deprecation") Iterable<PartitionedDataset<E>> getPartitions(); void addExistingPartitions(); @Override String toString(); @Override void merge(FileSystemDataset<E> update); @Override boolean canReplace(View<E> part); @Override void replace(View<E> target, View<E> replacement); @Override InputFormat<E, Void> getInputFormat(Configuration conf); @SuppressWarnings("unchecked") PartitionKey keyFromDirectory(Path dir); @Override long getSize(); @Override long getLastModified(); @Override boolean isEmpty(); @Override void signalReady(); @Override boolean isReady();  }### Answer:
@Test @SuppressWarnings("deprecation") public void testDropPartition() throws IOException { PartitionStrategy partitionStrategy = new PartitionStrategy.Builder() .hash("username", 2).build(); FileSystemDataset<Record> ds = new FileSystemDataset.Builder<Record>() .namespace("ns") .name("partitioned-users") .configuration(getConfiguration()) .descriptor(new DatasetDescriptor.Builder() .schema(USER_SCHEMA) .format(format) .compressionType(compressionType) .location(testDirectory) .partitionStrategy(partitionStrategy) .build()) .type(Record.class) .build(); writeTestUsers(ds, 10); Assert.assertTrue( fileSystem.isDirectory(new Path(testDirectory, "username_hash=0"))); Assert.assertTrue( fileSystem.isDirectory(new Path(testDirectory, "username_hash=1"))); ds.dropPartition(new PartitionKey(0)); Assert.assertFalse( fileSystem.isDirectory(new Path(testDirectory, "username_hash=0"))); ds.dropPartition(new PartitionKey(1)); Assert.assertFalse( fileSystem.isDirectory(new Path(testDirectory, "username_hash=1"))); DatasetException caught = null; try { ds.dropPartition(new PartitionKey(0)); } catch (DatasetException e) { caught = e; } Assert.assertNotNull(caught); }