Search in sources :

Example 1 with ExampleClass

use of net.bytebuddy.benchmark.specimen.ExampleClass in project byte-buddy by raphw.

the class ClassByExtensionBenchmarkTest method testByteBuddyWithPrefixClassCreationCachedWithTypePool.

@Test
public void testByteBuddyWithPrefixClassCreationCachedWithTypePool() throws Exception {
    ExampleClass instance = classByExtensionBenchmark.benchmarkByteBuddyWithPrefixAndReusedDelegatorWithTypePool();
    assertThat(instance.getClass(), not(CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS)));
    assertThat(instance.getClass().getSuperclass(), CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS));
    assertThat(classByExtensionBenchmark.benchmarkByteBuddyWithProxy().getClass(), not(CoreMatchers.<Class<?>>is(instance.getClass())));
    assertReturnValues(instance);
}
Also used : ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) Test(org.junit.Test)

Example 2 with ExampleClass

use of net.bytebuddy.benchmark.specimen.ExampleClass in project byte-buddy by raphw.

the class ClassByExtensionBenchmarkTest method testByteBuddyWithPrefixClassCreationCached.

@Test
public void testByteBuddyWithPrefixClassCreationCached() throws Exception {
    ExampleClass instance = classByExtensionBenchmark.benchmarkByteBuddyWithPrefixAndReusedDelegator();
    assertThat(instance.getClass(), not(CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS)));
    assertThat(instance.getClass().getSuperclass(), CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS));
    assertThat(classByExtensionBenchmark.benchmarkByteBuddyWithProxy().getClass(), not(CoreMatchers.<Class<?>>is(instance.getClass())));
    assertReturnValues(instance);
}
Also used : ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) Test(org.junit.Test)

Example 3 with ExampleClass

use of net.bytebuddy.benchmark.specimen.ExampleClass in project byte-buddy by raphw.

the class ClassByExtensionBenchmarkTest method testCglibClassCreation.

@Test
public void testCglibClassCreation() throws Exception {
    ExampleClass instance = classByExtensionBenchmark.benchmarkCglib();
    assertThat(instance.getClass(), not(CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS)));
    assertThat(instance.getClass().getSuperclass(), CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS));
    assertThat(classByExtensionBenchmark.benchmarkCglib().getClass(), not(CoreMatchers.<Class<?>>is(instance.getClass())));
    assertReturnValues(instance);
}
Also used : ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) Test(org.junit.Test)

Example 4 with ExampleClass

use of net.bytebuddy.benchmark.specimen.ExampleClass in project byte-buddy by raphw.

the class ClassByExtensionBenchmarkTest method testBaseline.

@Test
public void testBaseline() throws Exception {
    ExampleClass instance = classByExtensionBenchmark.baseline();
    assertThat(instance.getClass(), CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS));
    assertReturnValues(instance);
}
Also used : ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) Test(org.junit.Test)

Example 5 with ExampleClass

use of net.bytebuddy.benchmark.specimen.ExampleClass in project byte-buddy by raphw.

the class ClassByExtensionBenchmarkTest method testByteBuddyWithProxiesClassCreationCached.

@Test
public void testByteBuddyWithProxiesClassCreationCached() throws Exception {
    ExampleClass instance = classByExtensionBenchmark.benchmarkByteBuddyWithProxyAndReusedDelegator();
    assertThat(instance.getClass(), not(CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS)));
    assertThat(instance.getClass().getSuperclass(), CoreMatchers.<Class<?>>is(ClassByExtensionBenchmark.BASE_CLASS));
    assertThat(classByExtensionBenchmark.benchmarkByteBuddyWithProxy().getClass(), not(CoreMatchers.<Class<?>>is(instance.getClass())));
    assertReturnValues(instance);
}
Also used : ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) ExampleClass(net.bytebuddy.benchmark.specimen.ExampleClass) Test(org.junit.Test)

Aggregations

ExampleClass (net.bytebuddy.benchmark.specimen.ExampleClass)17 Test (org.junit.Test)16 Method (java.lang.reflect.Method)1 MethodFilter (javassist.util.proxy.MethodFilter)1 MethodHandler (javassist.util.proxy.MethodHandler)1 ProxyFactory (javassist.util.proxy.ProxyFactory)1