@Test public void testToString() { String topic = "sample"; int partition = 0; Node leader = new Node(0, "localhost", 9092); Node r1 = new Node(1, "localhost", 9093); Node r2 = new Node(2, "localhost", 9094); Node[] replicas = new Node[] {leader, r1, r2}; Node[] inSyncReplicas = new Node[] {leader, r1, r2}; PartitionInfo partitionInfo = new PartitionInfo(topic, partition, leader, replicas, inSyncReplicas); String expected = String.format("Partition(topic = %s, partition = %d, leader = %s, replicas = %s, isr = %s)", topic, partition, leader.idString(), "[0,1,2]", "[0,1,2]"); Assert.assertEquals(expected, partitionInfo.toString()); }
@Override public String toString() { return String.format("Partition(topic = %s, partition = %d, leader = %s, replicas = %s, isr = %s)", topic, partition, leader == null ? "none" : leader.idString(), formatNodeIds(replicas), formatNodeIds(inSyncReplicas)); }
PartitionInfo { @Override public String toString() { return String.format("Partition(topic = %s, partition = %d, leader = %s, replicas = %s, isr = %s)", topic, partition, leader == null ? "none" : leader.idString(), formatNodeIds(replicas), formatNodeIds(inSyncReplicas)); } }
PartitionInfo { @Override public String toString() { return String.format("Partition(topic = %s, partition = %d, leader = %s, replicas = %s, isr = %s)", topic, partition, leader == null ? "none" : leader.idString(), formatNodeIds(replicas), formatNodeIds(inSyncReplicas)); } PartitionInfo(String topic, int partition, Node leader, Node[] replicas, Node[] inSyncReplicas); }
PartitionInfo { @Override public String toString() { return String.format("Partition(topic = %s, partition = %d, leader = %s, replicas = %s, isr = %s)", topic, partition, leader == null ? "none" : leader.idString(), formatNodeIds(replicas), formatNodeIds(inSyncReplicas)); } PartitionInfo(String topic, int partition, Node leader, Node[] replicas, Node[] inSyncReplicas); String topic(); int partition(); Node leader(); Node[] replicas(); Node[] inSyncReplicas(); @Override String toString(); }
PartitionInfo { @Override public String toString() { return String.format("Partition(topic = %s, partition = %d, leader = %s, replicas = %s, isr = %s)", topic, partition, leader == null ? "none" : leader.idString(), formatNodeIds(replicas), formatNodeIds(inSyncReplicas)); } PartitionInfo(String topic, int partition, Node leader, Node[] replicas, Node[] inSyncReplicas); String topic(); int partition(); Node leader(); Node[] replicas(); Node[] inSyncReplicas(); @Override String toString();  }