@Test @SuppressWarnings("unchecked") public void toDirNameIdentityWithNonString() { PartitionStrategy strategy = new PartitionStrategy.Builder().identity("id").build(); StorageKey expected = new StorageKey(strategy); expected.replace(0, 0L); Assert.assertEquals( "Should convert to schema type", expected, convert.toKey(new Path("id=0"), new StorageKey(strategy))); }
@Test @SuppressWarnings("unchecked") public void testToKey() { PartitionStrategy strategy = new PartitionStrategy.Builder() .year("timestamp") .month("timestamp") .day("timestamp") .build(); StorageKey expected = new StorageKey(strategy); expected.replaceValues((List) Lists.newArrayList(2013, 11, 5)); Assert.assertEquals( expected, convert.toKey(new Path("year=2013/month=11/day=5"), new StorageKey(strategy))); }