public synchronized Counter findCounter(String group, String name) {
    if (name.equals("MAP_INPUT_BYTES")) {
      LOG.warn("Counter name MAP_INPUT_BYTES is deprecated. " +
               "Use FileInputFormatCounters as group name and " +
               " BYTES_READ as counter name instead");
      return findCounter(FileInputFormatCounter.BYTES_READ);
    }
    String newGroupKey = getNewGroupKey(group);
    if (newGroupKey != null) {
      group = newGroupKey;
    }
    return getGroup(group).getCounterForName(name);
  }
@SuppressWarnings("rawtypes")
  @Test
  public void testTaskCounter() {
    GroupFactory groupFactory = new GroupFactoryForTest();
    FrameworkGroupFactory frameworkGroupFactory =
        groupFactory.newFrameworkGroupFactory(TaskCounter.class);
    Group group = (Group) frameworkGroupFactory.newGroup("TaskCounter");

    FrameworkCounterGroup counterGroup =
        (FrameworkCounterGroup) group.getUnderlyingGroup();

    org.apache.hadoop.mapreduce.Counter count1 =
        counterGroup.findCounter(
            TaskCounter.PHYSICAL_MEMORY_BYTES.toString());
    Assert.assertNotNull(count1);
    count1.increment(10);
    count1.increment(10);
    Assert.assertEquals(20, count1.getValue());

    // Verify no exception get thrown when finding an unknown counter
    org.apache.hadoop.mapreduce.Counter count2 =
        counterGroup.findCounter(
            TaskCounter.MAP_PHYSICAL_MEMORY_BYTES_MAX.toString());
    Assert.assertNotNull(count2);
    count2.increment(5);
    count2.increment(10);
    Assert.assertEquals(10, count2.getValue());
  }