@Test
  public void testSubclassesAlso() throws UnmodifiableClassException {
    final BasicFunctions bf = new BasicFunctions();
    ConstructorInstrumenter.instrumentClass(
        BasicFunctions.class,
        new ConstructorCallback<BasicFunctions>() {
          @Override
          public void sample(BasicFunctions newBf) {
            bf.count++;
          }
        });

    int numBFs = 2;
    SubclassOfBasicFunctions unused = new SubclassOfBasicFunctions();
    BasicFunctions unused2 = 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