2,243 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
160
views
wiremock AutoConfigureWireMock HttpHostConnectException: Connection refused
@ActiveProfiles("it")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ContextConfiguration(classes = ServiceApplication.class)
@AutoConfigureWireMock(port = 0)
@...
0
votes
0
answers
41
views
Spring Boot Load Beans Only related to Junit
Currently while running Spring/Springboot within Junit suite or Unit test cases, when we provide necessary beans injected using SpringRunner or SpringBoot, it loads all the spring beans from the Path ...
1
vote
0
answers
54
views
Can I isolate the application context of a SpringBootTest test class entirely?
I am creating functional tests for Kafka consumers using @SpringBootTest, and one functional test (throwing an unknown exception) seems to require me to create a mock or spy and replace the existing ...
2
votes
1
answer
151
views
SpringBootTest context with mapstruct.Mapper bean
I'm working in an application where I need to map some input to an entity class and I'm using mapstruct like this:
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct....
0
votes
1
answer
149
views
What's the deal with url and urlPattern in WireMock?
I use WireMock to stub the following URL to an external service: /users/{username}/repos. The official docs says that using regexes is discouraged
note Using the Path and query regex is generally not ...
0
votes
1
answer
127
views
data class marked with ConfigurationProperties is not loaded in SpringBootTest
I have Spring Boot 3.5 application:
@SpringBootApplication(
scanBasePackages = [
...
]
)
@EnableConfigurationProperties(
value = [
....
MyProps::class,
]
)
...
1
vote
1
answer
57
views
InvalidDataAccessResourceUsage Error during .mvnw/ clean verify
I keep getting this error whenever I try to do .mvnw/ clean verify
[ERROR] Errors: [ERROR]
AuthorRepositoryIntegrationTests.testThatAuthorCanBeUpdated:68 »
InvalidDataAccessResourceUsage could not ...
1
vote
1
answer
120
views
Asserting against DB state in Spring Boot integration test
How do I check the DB state in an integration test? Is injecting a JdbcTemplate the only option?
For example, you test a PATCH that, if successful, should update certain table cells.
I can't use a ...
0
votes
1
answer
75
views
How to replace a bean in spring test context
I have spring boot tests where I test controllers, services, repositories, and kafka using testcontainers.
I want to have unique topics for each test method. However, I also don't want to create a lot ...
0
votes
1
answer
120
views
Duplicate Content-Type header in Spring REST Docs using RestAssuredMockMvc
I'm currently writing tests using RestAssuredMockMvc together with Spring REST Docs.
Setup
In my global spec setup, I configure the headers like this:
package com.animore.config
import com.fasterxml....
0
votes
1
answer
30
views
insert date in composite type during a @DatabaseSetup
In postgresql, I have a user defined type like that:
create type my_type as (
ts timestamptz,
val int
)
Then a table using that type:
create table my_table (
id serial,
ds my_type
)
I can ...
0
votes
0
answers
54
views
How to populate setter getter methods in a class annotated with @Configuration in Junit Test case
I have created a library using Spring to send message using Kafka Template. I am using the library in Spring boot application. The configuration fields are fetched from application.yml in Sprint boot ...
0
votes
2
answers
373
views
Test Springboot + SQS + Localstack throws exceptions
I have an application with Springboot and AWS Cloud SQS and I want to test it using Localstack.
All my tests run with a green status successfully, but my terminal is full of errors. The errors are as ...
-2
votes
1
answer
114
views
How to create an ArchUnit rule to check @SpringBootApplication class should only contain the public static void main(final String[] args) method
I am hoping to write an ArchUnit test which does the following:
For a class annotated with @SpringBootApplication:
The name of the class should end with Application
There should be only one class in ...
1
vote
0
answers
103
views
JUnit test passes on JVM but fails on nativeTest profile (Jextract + GraalVM + Spring Boot)
I'm working in a project which combines Spring Boot 3.4 with GraalVM native build, Jextract and Foreign Function & Memory API (Project Panama).
When I build and run my JUnit tests, it works in ...