@Test @Category(SecondaryTests.class) public void testBatchRemoveRange() throws StorageException { ArrayList<TableOperation> ops = allOpsList(); TableBatchOperation batch = new TableBatchOperation(); batch.addAll(ops); batch.removeRange(0, ops.size()); assertEquals(0, batch.size()); // should be able to add an entity with a different partition key Class1 baseEntity = TableTestHelper.generateRandomEntity("jxscl_odata_2"); batch.insert(baseEntity); batch.removeRange(0, 1); batch.addAll(ops); batch.removeRange(0, ops.size() - 1); // should be not be able to add an entity with a different partition key baseEntity = TableTestHelper.generateRandomEntity("jxscl_odata_2"); try { batch.insert(baseEntity); fail(SR.OPS_IN_BATCH_MUST_HAVE_SAME_PARTITION_KEY); } catch (IllegalArgumentException e) { assertEquals(SR.OPS_IN_BATCH_MUST_HAVE_SAME_PARTITION_KEY, e.getMessage()); } batch.removeRange(0, 1); // should be able to add a retrieve to the batch Class1 ref = TableTestHelper.generateRandomEntity("jxscl_odata"); TableOperation queryOp = TableOperation.retrieve(ref.getPartitionKey(), ref.getRowKey(), ref.getClass()); batch.add(queryOp); }