Пример #1
0
 @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);
 }
Пример #2
0
 @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));
 }