@Override
  @Deprecated
  @SuppressWarnings("unchecked")
  public <T extends Number> Counter<T> counter(String name, Class<T> type, Unit unit) {
    if (Integer.class.equals(type)) {
      return (Counter<T>) new DefaultCounter(unit).asIntCounter();
    }

    if (Long.class.equals(type)) {
      return (Counter<T>) new DefaultCounter(unit).asLongCounter();
    }
    throw new IllegalArgumentException(
        String.format("Counter for type %s is not supported", type.getName()));
  }
@Test
  public void intCounter() {
    MetricsContext metricsContext = new DefaultMetricsContext();
    MetricsContext.Counter<Integer> counter =
        metricsContext.counter("intCounter", Integer.class, MetricsContext.Unit.BYTES);
    counter.increment(5);
    assertThat(counter.value()).isEqualTo(5);
    assertThat(counter.unit()).isEqualTo(MetricsContext.Unit.BYTES);
  }