@Before public void setUp() throws Exception { explicitAuxiliaryTypes = Collections.singletonList(firstAuxiliary); when(engine.create(any(Instrumentation.Context.ExtractableView.class))).thenReturn(MAIN); when(firstAuxiliary.getTypeDescription()).thenReturn(otherAuxiliaryDescription); when(firstAuxiliary.getBytes()).thenReturn(FIRST); }
@Test public void testDynamicTypeCreation() throws Exception { DynamicType dynamicType = new TypeWriter.Default<Object>( instrumentedType, loadedTypeInitializer, typeInitializer, explicitAuxiliaryTypes, classFileVersion, engine) .make(); assertThat(dynamicType.getBytes(), is(MAIN)); assertThat(dynamicType.getTypeDescription(), is(instrumentedType)); assertThat( dynamicType.getLoadedTypeInitializers().get(instrumentedType), is(loadedTypeInitializer)); assertThat(dynamicType.getRawAuxiliaryTypes().size(), is(1)); assertThat(dynamicType.getRawAuxiliaryTypes().get(otherAuxiliaryDescription), is(FIRST)); }