GH-795 - Using @MockitoBean and @MockitoSpyBean.

This commit is contained in:
K. Siva Prasad Reddy
2024-09-02 20:06:15 +05:30
committed by Oliver Drotbohm
parent 5d57e2ce0f
commit 2b6a0bebf2
12 changed files with 27 additions and 27 deletions

View File

@@ -19,7 +19,7 @@ import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.modulith.core.ApplicationModules;
import org.springframework.modulith.test.ModuleTestExecution;
@@ -36,7 +36,7 @@ class FieldInjectedIntegrationTest {
@Autowired ModuleTestExecution execution;
@MockBean ServiceComponentA dependency;
@MockitoBean ServiceComponentA dependency;
@Test
void rejectsFieldInjection() {

View File

@@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigurationPackages;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.context.ApplicationContext;
import org.springframework.modulith.test.ApplicationModuleTest.BootstrapMode;
import org.springframework.modulith.test.TestUtils;
@@ -55,7 +55,7 @@ class ModuleBTest {
static class WithMocksTest {
@Autowired ApplicationContext context;
@MockBean ServiceComponentA serviceComponentA;
@MockitoBean ServiceComponentA serviceComponentA;
@Test
void bootstrapsModuleB() {

View File

@@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.modulith.test.ApplicationModuleTest.BootstrapMode;
import org.springframework.modulith.test.TestUtils;
@@ -61,7 +61,7 @@ class ModuleCTest {
@NonVerifyingModuleTest(BootstrapMode.DIRECT_DEPENDENCIES)
static class SucceedsWithDirectDependencyPlusItsDependenciesMocksTest {
@MockBean ServiceComponentA serviceComponentA;
@MockitoBean ServiceComponentA serviceComponentA;
@Test
void bootstrapsContext() {