static {
   try {
     s_weaver =
         new DCRWeaver(
             new ASMTransformerFactory(RecorderLocator.class),
             ExposeInstrumentation.getInstrumentation());
   } catch (WeavingException e) {
     throw new ExceptionInInitializerError(e);
   }
 }
  public void testInstrumentUnmodifiableCLass() throws Exception {

    final RandomStubFactory<Instrumentation> instrumentationStubFactory =
        RandomStubFactory.create(Instrumentation.class);
    final Instrumentation instrumentation = instrumentationStubFactory.getStub();

    ExposeInstrumentation.premain("", instrumentation);

    instrumentationStubFactory.setThrows("retransformClasses", new UnmodifiableClassException());

    // Create a new weaver to force the weaving.
    final JavaDCRInstrumenter instrumenter =
        new JavaDCRInstrumenter(
            new DCRWeaver(
                new ASMTransformerFactory(RecorderLocator.class),
                ExposeInstrumentation.getInstrumentation()),
            RecorderLocator.getRecorderRegistry());

    try {
      instrumenter.createInstrumentedProxy(null, m_recorder, MyClass.class);
      fail("Expected NotWrappableTypeException");
    } catch (NotWrappableTypeException e) {
    }
  }
 @Override
 protected void tearDown() throws Exception {
   super.tearDown();
   ExposeInstrumentation.premain("", m_originalInstrumentation);
   RecorderLocator.clearRecorders();
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   m_originalInstrumentation = ExposeInstrumentation.getInstrumentation();
 }