Skip to content

Commit

Permalink
[#238] Fixed failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skapral committed Feb 15, 2019
1 parent 2f4999d commit 94b1b22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;

import static org.assertj.core.api.Assertions.assertThatCode;

Expand Down Expand Up @@ -60,7 +61,7 @@ public final void check() throws Exception {
final DynamicType.Unloaded<?> make = bt
.transitionResult(subclass, typeDescription)
.make();
final Class<?> clazz = make.load(new AnonymousClassLoader()).getLoaded();
final Class<?> clazz = make.load(new AnonymousClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST).getLoaded();
clazz.getMethods(); // Initiate validation.
}).doesNotThrowAnyException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.bytebuddy.dynamic.DynamicType;

import java.lang.annotation.Annotation;
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down Expand Up @@ -63,7 +64,7 @@ public final void check() throws Exception {
final DynamicType.Unloaded<?> make = builderTransition
.transitionResult(subclass, typeDescription)
.make();
final Class<?> clazz = make.load(new AnonymousClassLoader()).getLoaded();
final Class<?> clazz = make.load(new AnonymousClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST).getLoaded();
assertThat(clazz.getAnnotation(annotation))
.withFailMessage("Expected annotation %s is missing on class %s", annotation.getName(), clazz.getName())
.isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import net.bytebuddy.dynamic.DynamicType;

import java.lang.reflect.Method;
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down Expand Up @@ -79,7 +80,7 @@ public final void check() throws Exception {
final DynamicType.Unloaded<?> make = bt
.transitionResult(subclass, typeDescription)
.make();
final Class<?> newClazz = make.load(new AnonymousClassLoader()).getLoaded();
final Class<?> newClazz = make.load(new AnonymousClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST).getLoaded();
assertThat(
List.of(newClazz.getDeclaredMethods()).map(Method::getName)
).containsOnlyElementsOf(
Expand All @@ -92,5 +93,6 @@ public final void check() throws Exception {
*
* @author Kapralov Sergey
*/
private static final class AnonymousClassLoader extends ClassLoader {}
private static final class AnonymousClassLoader extends ClassLoader {
}
}

0 comments on commit 94b1b22

Please sign in to comment.