<commit_before>package com.google.inject.stat;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.stat.testservices.DummyService;


import org.junit.Test;

import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author <EMAIL> (<NAME>)
 */
public class StatsIntegrationTest {
  @Test
  public final void testRecordingStatsInAnyGuiceObject() {
    Injector injector = Guice.createInjector(new AbstractModule() {
      @Override
      protected void configure() {
        install(new StatModule("/stat"));

        bind(DummyService.class);
      }
    });

    DummyService service = injector.getInstance(DummyService.class);

    service.call();
    service.call();
    service.call();

    assertEquals(3, service.getCalls().intValue());

    Stats stats = injector.getInstance(Stats.class);
    Map<StatDescriptor, Object> snapshot = stats.snapshot();

    assertEquals(1, snapshot.size());
    Map.Entry<StatDescriptor, Object> entry =
        snapshot.entrySet().iterator().next();

    StatDescriptor statDescriptor = entry.getKey();
    assertEquals(DummyService.NUMBER_OF_CALLS, statDescriptor.getName());
    Object value = entry.getValue();
    // This assertion also checks that the value is the true underlying value
    // of the stat, and not only a string representation.
    AtomicInteger atomicIntegerValue = (AtomicInteger) value;
    assertEquals(3, atomicIntegerValue.get());
  }
}
<commit_msg>We expect AtomicInteger, not necessarily int.<commit_after>package com.google.inject.stat;

import static org.junit.Assert.assertEquals;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.stat.testservices.DummyService;

import org.junit.Test;

import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author <EMAIL> (<NAME>)
 */
public class StatsIntegrationTest {
  @Test
  public final void testRecordingStatsInAnyGuiceObject() {
    Injector injector = Guice.createInjector(new AbstractModule() {
      @Override
      protected void configure() {
        install(new StatModule("/stat"));

        bind(DummyService.class);
      }
    });

    DummyService service = injector.getInstance(DummyService.class);

    service.call();
    service.call();
    service.call();

    assertEquals(3, service.getCalls().intValue());

    Stats stats = injector.getInstance(Stats.class);
    Map<StatDescriptor, Object> snapshot = stats.snapshot();

    assertEquals(1, snapshot.size());
    Map.Entry<StatDescriptor, Object> entry =
        snapshot.entrySet().iterator().next();

    StatDescriptor statDescriptor = entry.getKey();
    assertEquals(DummyService.NUMBER_OF_CALLS, statDescriptor.getName());
    Object value = entry.getValue();
    // This assertion also checks that the value is the true underlying value
    // of the stat, and not only a string representation.
    AtomicInteger atomicIntegerValue = (AtomicInteger) value;
    assertEquals(3, atomicIntegerValue.get());
  }
}

{'fraction_non_alphanumeric': 0.11784932791497343, 'fraction_numerical': 0.001875586120662707, 'mean_word_length': 4.047318611987381, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4442033', 'n_tokens_mistral': 901, 'n_tokens_neox': 886, 'n_words': 202}