Search in sources :

Example 1 with TypeInitializer

use of net.bytebuddy.dynamic.scaffold.TypeInitializer in project byte-buddy by raphw.

the class TypeInitializerTest method testSimpleApplication.

@Test
public void testSimpleApplication() throws Exception {
    TypeInitializer typeInitializer = new TypeInitializer.Simple(byteCodeAppender);
    assertThat(typeInitializer.isDefined(), is(true));
    typeInitializer.apply(methodVisitor, implementationContext, methodDescription);
    verify(byteCodeAppender).apply(methodVisitor, implementationContext, methodDescription);
    verifyZeroInteractions(byteCodeAppender);
    verifyZeroInteractions(implementationContext);
}
Also used : TypeInitializer(net.bytebuddy.dynamic.scaffold.TypeInitializer) Test(org.junit.Test)

Example 2 with TypeInitializer

use of net.bytebuddy.dynamic.scaffold.TypeInitializer in project byte-buddy by raphw.

the class ImplementationContextDisabledTest method testFactoryWithTypeInitializer.

@Test(expected = IllegalStateException.class)
public void testFactoryWithTypeInitializer() throws Exception {
    TypeInitializer typeInitializer = mock(TypeInitializer.class);
    when(typeInitializer.isDefined()).thenReturn(true);
    Implementation.Context.Disabled.Factory.INSTANCE.make(instrumentedType, mock(AuxiliaryType.NamingStrategy.class), typeInitializer, mock(ClassFileVersion.class), mock(ClassFileVersion.class));
}
Also used : ClassFileVersion(net.bytebuddy.ClassFileVersion) TypeInitializer(net.bytebuddy.dynamic.scaffold.TypeInitializer) Test(org.junit.Test)

Aggregations

TypeInitializer (net.bytebuddy.dynamic.scaffold.TypeInitializer)2 Test (org.junit.Test)2 ClassFileVersion (net.bytebuddy.ClassFileVersion)1