MetricsPacket { public List<ConsumerId> consumers() { return unmodifiableList(consumers); } private  MetricsPacket(int statusCode, String statusMessage, long timestamp, ServiceId service,
                          Map<MetricId, Number> metrics, Map<DimensionId, String> dimensions, Set<ConsumerId> consumers ); Map<MetricId, Number> metrics(); Map<DimensionId, String> dimensions(); List<ConsumerId> consumers(); @Override String toString(); final int statusCode; final String statusMessage; final long timestamp; final ServiceId service; }
@Test public void consumers_are_always_distinct() { ConsumerId DUPLICATE_CONSUMER = toConsumerId("duplicateConsumer"); MetricsPacket packet = new MetricsPacket.Builder(toServiceId("foo")) .statusCode(0) .statusMessage("") .addConsumers(singleton(DUPLICATE_CONSUMER)) .addConsumers(singleton(DUPLICATE_CONSUMER)) .build(); assertEquals(1, packet.consumers().size()); }