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) { } }
public TestJavaDCRInstrumenter() throws Exception { m_instrumenter = new JavaDCRInstrumenter(s_weaver, RecorderLocator.getRecorderRegistry()); }