@Test public void testPartitionTable() { PartitionTable operation = SchemaOperations.partitionTable("users") .into("debtors", "credit < 0") .into("creditors", "credit > 0"); Map<String, String> partitions = Maps.newHashMap(); partitions.put("debtors", "credit < 0"); partitions.put("creditors", "credit > 0"); assertEquals("users", operation.getTableName()); assertEquals(partitions, operation.getPartitions()); }
@Test(expected = IllegalArgumentException.class) public void testThatYouCannotDecomposeIntoTheSameTableTwice() { SchemaOperations.partitionTable("users").into("creditors", "true").into("creditors", "true"); }
@Test(expected = IllegalArgumentException.class) public void testThatDecompositionExpressionCannotBeEmptyString() { SchemaOperations.partitionTable("users").into("creditors", ""); }
@Test(expected = IllegalArgumentException.class) public void testThatDecompositionTableNameCannotBeNull() { SchemaOperations.partitionTable("users").into(null, "credit < 0"); }
@Test(expected = IllegalArgumentException.class) public void testThatTableNameCannotBeEmptyString() { SchemaOperations.partitionTable(""); }
@Test(expected = IllegalArgumentException.class) public void testThatTableNameCannotBeNull() { SchemaOperations.partitionTable(null); }