### Question:
CompositeMetricsSerializer extends SystemMetricsSerializer<CompositeMetrics> { public <T extends SystemMetrics<T>> CompositeMetricsSerializer addMetricsSerializer( Class<T> metricsClass, SystemMetricsSerializer<T> serializer) { Class<? extends SystemMetrics<?>> existingClass = mDeserializerClasses.get(serializer.getTag()); if (existingClass != null && existingClass != metricsClass) { throw new RuntimeException( "Serializers " + existingClass.getCanonicalName() + " and " + metricsClass.getCanonicalName() + " have a conflicting tag: `" + serializer.getTag() + "`."); } mSerializers.put(metricsClass, serializer); mDeserializers.put(serializer.getTag(), serializer); mDeserializerClasses.put(serializer.getTag(), metricsClass); return this; }  CompositeMetricsSerializer addMetricsSerializer(
      Class<T> metricsClass, SystemMetricsSerializer<T> serializer); @Override long getTag(); @Override void serializeContents(CompositeMetrics metrics, DataOutput output); @Override boolean deserializeContents(CompositeMetrics metrics, DataInput input);  }### Answer:
@Test(expected = RuntimeException.class) public void testMetricsWithTheSameTag() { CompositeMetricsSerializer serializer = new CompositeMetricsSerializer(); serializer.addMetricsSerializer(A.class, new ASerializer()); serializer.addMetricsSerializer(B.class, new BSerializer()); }