TopicDiff { public boolean changesNumPartitions() { return this.differences.containsKey(NumPartitionsDifference.ADDRESS); } private  TopicDiff(Map<String, Difference> differences, ObjectMeta objectMeta); static TopicDiff diff(Topic source, Topic target); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); boolean isEmpty(); boolean changesNumPartitions(); int numPartitionsDelta(); boolean changesConfig(); boolean changesReplicationFactor(); Topic apply(Topic topic); String conflict(TopicDiff other); boolean conflicts(TopicDiff other); TopicDiff merge(TopicDiff other);  }
@Test public void testChangesNumPartitions() { Topic topicC = new Topic.Builder(topicB.getTopicName(), topicB.getNumPartitions(), topicB.getConfig()).build(); assertThat(TopicDiff.diff(topicB, topicA).changesNumPartitions(), is(true)); assertThat(TopicDiff.diff(topicB, topicA).numPartitionsDelta(), is(-1)); assertThat(TopicDiff.diff(topicA, topicB).changesNumPartitions(), is(true)); assertThat(TopicDiff.diff(topicA, topicB).numPartitionsDelta(), is(1)); assertThat(TopicDiff.diff(topicB, topicC).changesNumPartitions(), is(false)); assertThat(TopicDiff.diff(topicB, topicC).numPartitionsDelta(), is(0)); }