@Test
 public void testGetBrokerInfo() throws Exception {
   String host = "localhost";
   int port = 9092;
   int partition = 0;
   addPartition(partition, host, port);
   GlobalPartitionInformation brokerInfo = dynamicBrokersReader.getBrokerInfo();
   assertEquals(1, brokerInfo.getOrderedPartitions().size());
   assertEquals(port, brokerInfo.getBrokerFor(partition).port);
   assertEquals(host, brokerInfo.getBrokerFor(partition).host);
 }
  @Test
  public void testMultiplePartitionsOnSameHost() throws Exception {
    String host = "localhost";
    int port = 9092;
    int partition = 0;
    int secondPartition = partition + 1;
    addPartition(partition, 0, host, port);
    addPartition(secondPartition, 0, host, port);

    GlobalPartitionInformation brokerInfo = dynamicBrokersReader.getBrokerInfo();
    assertEquals(2, brokerInfo.getOrderedPartitions().size());

    assertEquals(port, brokerInfo.getBrokerFor(partition).port);
    assertEquals(host, brokerInfo.getBrokerFor(partition).host);

    assertEquals(port, brokerInfo.getBrokerFor(secondPartition).port);
    assertEquals(host, brokerInfo.getBrokerFor(secondPartition).host);
  }