From fa91f13c3354406eb92904311d41d3f6aab4117c Mon Sep 17 00:00:00 2001 From: antoine Date: Thu, 14 Nov 2024 05:31:49 -0600 Subject: [PATCH] details --- .../test/mockinbean/MockInBeanTestExecutionListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/teketik/test/mockinbean/MockInBeanTestExecutionListener.java b/src/main/java/com/teketik/test/mockinbean/MockInBeanTestExecutionListener.java index b390df9..2b99ba0 100644 --- a/src/main/java/com/teketik/test/mockinbean/MockInBeanTestExecutionListener.java +++ b/src/main/java/com/teketik/test/mockinbean/MockInBeanTestExecutionListener.java @@ -64,7 +64,7 @@ public void beforeTestClass(TestContext testContext) throws Exception { beanField.setAccessible(true); final Object beanFieldValue = ReflectionUtils.getField(beanField, inBean); final TargetSource proxyTarget = BeanUtils.getProxyTarget(beanFieldValue); - BeanFieldState beanFieldState; + final BeanFieldState beanFieldState; if (proxyTarget != null) { beanFieldState = new ProxiedBeanFieldState(inBean, beanField, beanFieldValue, proxyTarget, definition); } else { @@ -116,6 +116,7 @@ public void beforeTestMethod(TestContext testContext) throws Exception { //if the target bean has been spied on, need to push into this spy as well (to allow mock in spies) Optional.ofNullable(spyTracker.get(bean)) .ifPresent(spy ->inject(fieldState.field, spy, mockOrSpy)); + }); super.beforeTestMethod(testContext);