It works with TestNG as well. Your test class needs to extend one of the following classes:
More Related Contents:
- Injecting Mockito mocks into a Spring bean
- Difference between @Mock, @MockBean and Mockito.mock()
- Populating Spring @Value during Unit Test
- Spring Test & Security: How to mock authentication?
- How to verify a method is called two times with mockito verify()
- Basic JUnit test for JavaFX 8
- How to in-memory unit test Spring-Jersey
- How to test a spring controller method by using MockMvc?
- Set System Property With Spring Configuration File
- request scoped beans in spring testing
- Disable @EnableScheduling on Spring Tests
- Transactional annotation avoids services being mocked
- Location of spring-context.xml
- java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger for JUnit test case for Java mail
- Reuse spring application context across junit test classes
- Rollback transaction after @Test
- How to test a mocked JNDI datasource with Spring?
- Injecting @Autowired private field during testing
- How to exclude *AutoConfiguration classes in Spring Boot JUnit tests?
- Another unnamed CacheManager already exists in the same VM (ehCache 2.5)
- @TestPropertySource doesn’t work for JUnit test with AnnotationConfigContextLoader in Spring 1.2.6
- How to rollback a database transaction when testing services with Spring in JUnit?
- spring junit load application context for tests
- java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)Z
- Spring JUnit: How to Mock autowired component in autowired component
- Getting Spring Error “Bean named ‘x’ must be of type [y], but was actually of type [$Proxy]” in Jenkins
- Reload or refresh a Spring application context inside a test method?
- NoSuchFieldError when trying to run a jUnit test with Spring
- Failed to load ApplicationContext caused by ArrayIndexOutOfBoundsException in ClassReader
- Spring not autowiring in unit tests with JUnit