@Test(expected = IllegalArgumentException.class) public void testTooManyPartitionDirectories() throws Exception { partitionKeyForPath(dataset, new Path(testDirectory, "username_part=1/email=2/extra=3").toUri()); }
@Test(expected = IllegalArgumentException.class) public void testNonExistentPartitionDirectory() throws Exception { partitionKeyForPath(dataset, new Path(testDirectory, "not_a_partition").toUri()); }
@Test(expected = IllegalArgumentException.class) public void testMissingPartitionValue() throws Exception { partitionKeyForPath(dataset, new Path(testDirectory, "username_part").toUri()); }
@Test(expected = IllegalArgumentException.class) public void testDifferentFileSystem() throws Exception { partitionKeyForPath(dataset, new URI("hdfs://namenode/")); }
@Test(expected = IllegalArgumentException.class) public void testDifferentRootDirectory() throws Exception { partitionKeyForPath(dataset, new Path(testDirectory.getParent(), "bogus").toUri()); }
@Test(expected = IllegalArgumentException.class) public void testInvalidPartitionName() throws Exception { partitionKeyForPath(dataset, new Path(testDirectory, "not_a_partition=1").toUri()); }
@Test public void testValidPartition() throws Exception { PartitionKey key = partitionKeyForPath(dataset, new Path(testDirectory, "username_part=1").toUri()); Assert.assertEquals(new PartitionKey(1), key); }