diff --git a/README.MD b/README.MD
index a8a8339..a4732bb 100644
--- a/README.MD
+++ b/README.MD
@@ -86,7 +86,7 @@ Simply include the maven dependency (from central maven) to start using @MockInB
com.teketik
mock-in-bean
- boot2-v1.5
+ boot2-v1.5.1
test
```
diff --git a/pom.xml b/pom.xml
index 9418f78..2097abd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
com.teketik
mock-in-bean
- boot2-v1.5
+ boot2-v1.5.1
Mock in Bean
Surgically Inject Mockito Mock/Spy in Spring Beans
https://github.com/antoinemeyer/mock-in-bean
diff --git a/src/main/java/com/teketik/test/mockinbean/MockInBeanTestExecutionListener.java b/src/main/java/com/teketik/test/mockinbean/MockInBeanTestExecutionListener.java
index 31ab61f..2c439ff 100644
--- a/src/main/java/com/teketik/test/mockinbean/MockInBeanTestExecutionListener.java
+++ b/src/main/java/com/teketik/test/mockinbean/MockInBeanTestExecutionListener.java
@@ -142,7 +142,7 @@ private Class> extractClass(Definition definition) {
private Class> resolveTestClass(Class> candidate) {
if (isNestedTestClass(candidate)) {
- return candidate.getEnclosingClass();
+ return resolveTestClass(candidate.getEnclosingClass());
}
return candidate;
}
diff --git a/src/test/java/com/teketik/test/mockinbean/test/NestedTest.java b/src/test/java/com/teketik/test/mockinbean/test/NestedTest.java
index fa7cd32..71e5fc7 100644
--- a/src/test/java/com/teketik/test/mockinbean/test/NestedTest.java
+++ b/src/test/java/com/teketik/test/mockinbean/test/NestedTest.java
@@ -39,6 +39,19 @@ public void test2() {
Mockito.when(expensiveProcessor.returnSomethingExpensive()).thenThrow(RuntimeException.class);
Assertions.assertThrows(RuntimeException.class, () -> myService.doSomething());
}
+
+ @Nested
+ class NestedInner1 {
+
+ @Test
+ void resultReturnMockedValue() {
+ final Object somethingExpensive = new Object();
+ Mockito.when(expensiveProcessor.returnSomethingExpensive()).thenReturn(somethingExpensive);
+ myService.doSomething();
+ Mockito.verify(thirdPartyApiService).doSomethingOnThirdPartyApi(somethingExpensive);
+ }
+
+ }
}
@Nested