From 06ed6c7ab69c9c236592107e05b417b3ba4db9b9 Mon Sep 17 00:00:00 2001 From: Stefan Bischof Date: Tue, 10 Nov 2020 18:20:42 +0100 Subject: [PATCH] fix mocking osgi-classes Signed-off-by: Stefan Bischof --- .../com/vaadin/flow/server/startup/EnableOSGiRunner.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flow-server/src/test/java/com/vaadin/flow/server/startup/EnableOSGiRunner.java b/flow-server/src/test/java/com/vaadin/flow/server/startup/EnableOSGiRunner.java index 398d8370118..f0dfa558063 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/startup/EnableOSGiRunner.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/startup/EnableOSGiRunner.java @@ -69,7 +69,7 @@ public synchronized Class loadClass(String name) Builder builder = new ByteBuddy() .subclass(Exception.class); return builder.name("org.osgi.framework.InvalidSyntaxException") - .make().load(this, ClassLoadingStrategy.Default.WRAPPER) + .make().load(this, ClassLoadingStrategy.Default.CHILD_FIRST.allowExistingTypes()) .getLoaded(); } else if (name.equals("org.osgi.framework.FrameworkUtil")) { Builder builder = new ByteBuddy() @@ -81,7 +81,7 @@ public synchronized Class loadClass(String name) .withParameter(Class.class) .intercept(MethodDelegation.to(Interceptor.class)) .name(name).make() - .load(this, ClassLoadingStrategy.Default.WRAPPER) + .load(this, ClassLoadingStrategy.Default.CHILD_FIRST.allowExistingTypes()) .getLoaded(); return fwUtil; } else if (name.startsWith(vaadinPackagePrefix)) { @@ -106,7 +106,7 @@ private Class defineBundleClass() { Builder builder = new ByteBuddy().makeInterface(); Class bundleClass = builder.name("org.osgi.framework.Bundle") - .make().load(this, ClassLoadingStrategy.Default.WRAPPER) + .make().load(this, ClassLoadingStrategy.Default.CHILD_FIRST.allowExistingTypes()) .getLoaded(); return bundleClass; }