Skip to main content

All Questions

Tagged with
1 vote
1 answer
442 views

NoSQLUnit MongoDB insert collection names are []

I am trying to write a JUnit test case for a Spring MongoDB Repository class in a Spring Boot project. But I keep getting the exception. com.lordofthejars.nosqlunit.core.NoSqlAssertionError: ...
Hong Z.'s user avatar
  • 45
2 votes
2 answers
16k views

Configure integration test or use Spring JDBC in Unit Test using Spring Boot?

Am using the latest versions of Spring Boot, Spring JDBC, and Spring Rest... My project is setup as a typical Maven project containing the following filesystem structure: myproject | --src/main/java/...
PacificNW_Lover's user avatar
83 votes
5 answers
135k views

How to write a unit test for a Spring Boot Controller endpoint

I have a sample Spring Boot app with the following Boot main class @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(...
user6123723's user avatar
  • 10.9k
2 votes
2 answers
3k views

Need to be able to catch Spring startup exception in unit test

I've got a situation where we want to inspect Spring MVC code on startup and throw an exception (thus causing the ApplicationContext to to fail) when certain conditions aren't met. Is there a way to ...
Josh Ghiloni's user avatar
  • 1,310
10 votes
3 answers
19k views

Spring JUnit Test not loading full Application Context

Hi I am trying to so spring junit test cases... and I require my full application context to be loaded. However the junit test does not initialize the full application context. Test class: @RunWith(...
Shivam Sinha's user avatar
  • 5,092
2 votes
1 answer
938 views

Spring Boot Tests within a Container

I have coded a Spring Boot based web application, which is expected to be run in WildFly server. The applications runs great, but the issue is with testing. I have the database connections, caching ...
rakpan's user avatar
  • 2,853
1 vote
0 answers
1k views

How to start Spring Boot server in @BeforeClass of junit

We need to use Spring Boot in our project for testing only at present. The Spring app configuration and test app configuration are as below: @TransactionConfiguration(transactionManager = "...
Paddy's user avatar
  • 3,552
0 votes
0 answers
4k views

Junit not working with Spring boot

I am trying to test my repository using Spring-boot. I followed http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html My Test class: @RunWith(...
rayman's user avatar
  • 21.4k
1 vote
1 answer
430 views

Another datasource for service layer unit testing

After learning JUnit and experienced its benefits for both programmer and the project, I wanted now to unit test the service layer of each entities and test if each methods works properly. As of now, ...
David B's user avatar
  • 3,531
1 vote
1 answer
1k views

Spring Boot Application with DB - Test class fails after context being recreated with @DirtiesContext

I'm trying to execute a set of JUnit4 tests classes of a Spring Boot Application that consists of multiple web services and has a database configured. Is convenient that the context is cleared after ...
jgbarcos's user avatar
92 votes
14 answers
196k views

How to exclude *AutoConfiguration classes in Spring Boot JUnit tests?

I tried: @RunWith(SpringJUnit4ClassRunner.class) @EnableAutoConfiguration(exclude=CrshAutoConfiguration.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration public ...
Hendy Irawan's user avatar
  • 21.1k
7 votes
1 answer
4k views

Integration testing of multi-war application in Spring Boot

I have an application composed of multiple maven war projects. I have another maven project that runs JUnit integration tests against the manually-started tomcat-deployed multi-war application using ...
sdoxsee's user avatar
  • 4,601
5 votes
2 answers
9k views

Unit testing a Spring Boot service class with(out) repository in JUnit

I am working on a spring boot based webservice with following structure: Controller (REST) --> Services --> Repositories (as suggested in some tutorials). My Database Connection (JPA/Hibernate/...
Alex's user avatar
  • 1,151

15 30 50 per page
1
154 155 156 157
158