@Before
 public void setup() {
   entities.add(Simple.class.getName());
   // use custom class loader which enhances the class
   InstrumentedClassLoader cl =
       new InstrumentedClassLoader(Thread.currentThread().getContextClassLoader());
   cl.setEntities(entities);
   this.loader = cl;
 }
  /**
   * Tests that class file enhancement works.
   *
   * @throws Exception in case the test fails.
   */
  @Test
  public void testEnhancement() throws Exception {
    // sanity check that the class is unmodified and does not contain getFieldHandler()
    assertFalse(implementsManaged(Simple.class));

    Class clazz = loader.loadClass(entities.get(0));

    // enhancement would have added the ManagedEntity interface...
    assertTrue(implementsManaged(clazz));
  }