Skip to main content

Questions tagged [spring-boot-test]

The tag has no usage guidance, but it has a tag wiki.

spring-boot-test
-4 votes
0 answers
24 views

Java Integration tests failing when I run them all at once, but separately they all pass [duplicate]

For some reason, integration tests in my project have started to fail when I run them all at once. error that I get is(I had to remove some of the stack trace because it was too long): java.sql....
Stefan Besovic's user avatar
-1 votes
0 answers
30 views

How to partially override properties in @SpringBootTest , so only mentioned properties in test.properties file is overriden

I would like to create an integration test in my project for every functions. I currently have: application.properties, the main properties, containing database configs and another configs , ...
Dhana D.'s user avatar
  • 1,698
0 votes
0 answers
24 views

In Spring Boot, how can I initialize database before context creation?

I want to initialize my database before Spring context is created. Then I want to initialize my components based on the content in the database. How do I do this? e.g. my component: @Component class ...
Soid's user avatar
  • 2,811
0 votes
2 answers
44 views

Why are there 2 Security Filter Chains defined for my Spring Boot Application?

I am trying to add a filter chain into my spring boot application like below. @Bean public SecurityFilterChain filterChain(HttpSecurity http, MyTokenIntrospector myTokenIntrospector) throws ...
Juan Bustamante's user avatar
-1 votes
0 answers
39 views

Second test fails, Wiremock stubs not being reset after test

I have a @SpringBootTest with 2 tests of a service (happy + negative flows) which calls an external API. I used wiremock to stub the response of that API. When I run each test individually they pass, ...
Gabriela83's user avatar
0 votes
0 answers
44 views

java.lang.ClassNotFoundException: jakarta.servlet.ServletConnection: Spring Boot and Jetty

Our project uses Spring Boot 3 and Jetty 11. As detailed here, there are some compatibility issues. So the jakarta.servlet-api:5.0.0 has been added explicitly. <dependency> <artifactId>...
Ramanujan R's user avatar
  • 1,711
-2 votes
0 answers
67 views

How to run the same test multiple times with a different SQL each time?

I got a task to make and test a method that, in summary, needed to return zero in case a field was negative, null, or if there were no records in the table. So although the starting values were ...
Leandro Batista's user avatar
-1 votes
1 answer
31 views

Kafka Consumer test works with SpringBootTest but not with ContextConfiguration

From my understanding of the @SpringBootTest configuration based on the docs, if the classes parameter is specified, it is equivalent with a @ContextConfiguration with the same parameter: The ...
Daniel Pop's user avatar
0 votes
1 answer
71 views

Unable to pass multipart file through mockMvc

I am writing junit test for my request method. Im using mockMvc to trigger the rest request. When I run my test I get the error java.lang.NullPointerException: Cannot invoke "org.springframework....
manjosh's user avatar
  • 564
0 votes
0 answers
29 views

Spring @Configuration Bean not excluded using excludeFilters when running tests

I have a main class that uses @ComponentScan along with excludeFilters to exclude a class that is used from a library. @Configuration @ComponentScan(basePackages = {"org.example"}, ...
global_warming's user avatar
0 votes
1 answer
59 views

@KafkaListener with containerFactory is not triggered in @SpringBootTest

I am trying to write an integration test for my Kafka consumer using @SpringBootTest and Testcontainers for the underlying infrastructure. My setup looks like this one: @Component @...
Daniel Pop's user avatar
0 votes
1 answer
34 views

Use admin user for database setup and app user for runnning the application in Springboot Tests with @Sql

I'm trying to automate an integration test on my backend application against an oracle database. I can bring up a separate docker container with the schema and i can connect to it using the schema ...
Joaquín Aramendía's user avatar
0 votes
0 answers
16 views

Unable to inject custom @JsonFilter in SpringBootTest

I have a data class for which I use a custom JsonFilter @JsonFilter(value = "conditional_serializers") data class DocumentRequest( val someField: String? = null, val someOtherField: ...
Makruzz's user avatar
  • 129
0 votes
0 answers
43 views

While building in Jenkins, the build fails with error

Starting a Gradle Daemon (subsequent builds will be faster) > Task :clean > Task :compileJava > Task :processResources > Task :classes > Task :resolveMainClassName > Task :bootWar &...
Son's user avatar
  • 1
2 votes
0 answers
46 views

Kotlin issue with Spring @TestConfiguration in Nested class

In Java I can define TestConfiguration in nested class class Example { @Nested @SpringBootTest public class ExampleNestedTest { @TestConfiguration public static class ...
user3908406's user avatar
  • 1,658

15 30 50 per page
1
2 3 4 5
99