@Test
  public void testBasicFunctionality() throws UnmodifiableClassException {
    final BasicFunctions bf = new BasicFunctions();
    ConstructorInstrumenter.instrumentClass(
        BasicFunctions.class,
        new ConstructorCallback<BasicFunctions>() {
          @Override
          public void sample(BasicFunctions newBf) {
            bf.count++;
          }
        });
    int numBFs = 10;
    for (int i = 0; i < numBFs; i++) {
      BasicFunctions unused = new BasicFunctions();
    }
    assertEquals("Did not see correct number of BasicFunctions", numBFs, bf.count);
  }
Test the constructor-instrumentation functionality of the bytecode rewriting agent.
src/test/java/com/google/monitoring/runtime/instrumentation/ConstructorInstrumenterTest.java