KafkaPublishTarget implements PublishTarget { static KafkaPublishTarget fromTargetAddress(final String targetAddress) { if (containsKey(targetAddress)) { return fromTargetAddressWithKey(targetAddress); } else if (containsPartition(targetAddress)) { return fromTargetAddressWithPartition(targetAddress); } return fromTargetAddressWithOnlyTopic(targetAddress); } private  KafkaPublishTarget(final String topic, @Nullable final String key, @Nullable final Integer partition); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void invalidCharsInTopicNameThrowError() { assertThatExceptionOfType(ConnectionConfigurationInvalidException.class) .isThrownBy(() -> KafkaPublishTarget.fromTargetAddress("events*andstuff")); }
@Test public void invalidPartitionThrowsError() { assertThatExceptionOfType(ConnectionConfigurationInvalidException.class) .isThrownBy(() -> KafkaPublishTarget.fromTargetAddress("events#notAnInteger")); }
@Test(expected = NullPointerException.class) public void testNull() { KafkaPublishTarget.fromTargetAddress(null); }