DatastreamProducerRecordBuilder { public void setPartition(int partition) { Validate.isTrue(partition >= 0, "invalid partition number: " + partition); _partition = Optional.of(partition); }  void setPartition(int partition); void setPartitionKey(String partitionKey); void setDestination(String destination); void setSourceCheckpoint(String sourceCheckpoint); void addEvent(Object key, Object value, Object previousValue, Map<String, String> metadata); void addEvent(BrooklinEnvelope envelope); void setEventsSourceTimestamp(long eventsSourceTimestamp); DatastreamProducerRecord build();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testBuilderThrowsWhenPartitionIsNegative() { DatastreamProducerRecordBuilder builder = new DatastreamProducerRecordBuilder(); builder.setPartition(-1); }