strategy, descriptor.getPartitionStrategy());
}
@Test
public void testDescriptorValidationFails() {
final PartitionStrategy missingStartField =
new PartitionStrategy.Builder()
.identity("p.latitude")
.identity("p.longitude")
.build();
TestHelpers.assertThrows("Should complain that p is missing",
IllegalStateException.class, new Runnable() {
@Override
public void run() {
new DatasetDescriptor.Builder()
.schema(schema)
.partitionStrategy(missingStartField)
.build();
}
});
final PartitionStrategy missingLongField =
new PartitionStrategy.Builder()
.identity("position.latitude")
.identity("position.long")
.build();
TestHelpers.assertThrows("Should complain that position.long is missing",
IllegalStateException.class, new Runnable() {
@Override
public void run() {
new DatasetDescriptor.Builder()
.schema(schema)
.partitionStrategy(missingLongField)
.build();
}
});
final PartitionStrategy badExpectedType =
new PartitionStrategy.Builder()
.identity("position.latitude")
.year("position.longitude")
.build();