Im struggling to figure out how to access a protected field using ByteBuddy and what approach to take.
Background: Id like to intercept a class from a dependency I have on my class path. Im creating a junit test report and need to intercept org.assertj.core.api.AbstractAssert in order to capture the actual
field value from that class.
Iv tried...
Class<?> type = new ByteBuddy()
.redefine(AbstractAssert.class)
.visit(Advice.to(MyAdvices.class).on(ElementMatchers.isMethod()))
.make().load(AbstractAssert.class.getClassLoader()).getLoaded();
log.info(type.getFields().toString());
Class already loaded: class org.assertj.core.api.AbstractAssert
Im not even sure if this is the correct approach for what Im trying to achieve
Any help appreciated