spring-boot-test Questions

2

Solved

I am working on a Spring boot application that uses Spring JPA with PostgreSQL. I am using @SpringBootTest(classes = <my package>.Application.class) to initialize my unit test for a controlle...
Papyrology asked 28/1, 2017 at 23:8

2

Solved

I have a SpringBoot based command line application. The application creates or deletes some records in a database. It does so not directly via JDBC but rather through a special API (instance variab...
Sharondasharos asked 11/2, 2022 at 23:9

1

None of these solutions helped here: Spring mockMvc doesn't consider validation in my test. Added all of these dependencies, nothing helps. I use Spring Boot 2.1.2, pom.xml: <parent> &...

3

I am trying to do integration test for app that using kafka, kafka-streams and cassandra. But when I am trying to setUp test class, i've got 2 errors: ERROR [main] BrokerMetadataCheckpoint: Failed...
Kish asked 25/1, 2019 at 11:59

2

I have a SpringBoot application with hibernate. In my tests I would like to disable any sort of db connection and configuration (tests don't have access to db). How should I do it ? My test class ...
Gdynia asked 23/10, 2019 at 7:10

1

I have 3 groups of tests: unit, integration, acceptance. Latter two groups launches ApplicationContext: minimal for "integration" and full for "acceptance". Both application contexts register qu...
Rick asked 30/4, 2018 at 11:24

3

I am working on an aggregation framework using spring boot, which can be used to aggregate multiple kinds of I/O operations' results. Additionally, it has support for both non-blocking (reactive) &...
Antoninus asked 15/3, 2022 at 10:24

6

Hey i have started learing spring-boot junit testing using spring boot Test framework at the time of creating the test case i am facing issues below . import static org.hamcrest.Matchers.contain...
Hardihood asked 12/7, 2018 at 6:52

10

I have a new springboot application I am attempting to get started. The error I receive is org.springframework.context.ApplicationContextException: Unable to start reactive web server; nested exc...
Glandular asked 14/5, 2018 at 12:2

1

I got "ContainerLaunchException: Timed out waiting for log output matching" when starting testcontainer for elasticserach. How should I fix this issue? container = new ElasticsearchContai...

10

Solved

I'm having a problem with following integration test import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @...
Sabu asked 1/3, 2019 at 15:27

1

Solved

For each controller I have following test class: @WebMvcTest(controllers = [MyFirstController::class]) @AutoConfigureMockMvc(addFilters = false) @Import(JacksonConfig::class) class MyFirstControlle...

7

Solved

I'm using TestContainers with Spring Boot to run unit tests for repositories like this: @Testcontainers @ExtendWith(SpringExtension.class) @ActiveProfiles("itest") @SpringBootTest(classes = RouteT...
Kaon asked 17/6, 2020 at 9:17

2

Solved

I have a /src/test/resources/application.properties with a simple spring-boot project: spring.main.banner-mode=off logging.level.root=ERROR logging.level.org.springframework.*=ERROR Problem: dur...
Timeless asked 20/1, 2020 at 11:18

4

I'm trying to perform a parametrized JUnit 5 test, how to accomplish the following? @ParametrizedTest @ValueSource //here it seems only one parameter is supported public void myTest(String paramete...
Beatify asked 16/6, 2020 at 7:11

2

Solved

I'm trying to run a @SpringBootTest in a "clean" context without having MyApplicationContextInitializer executed. The MyApplicationContextInitializer is included inside the spring.factories file ...
Mullein asked 15/12, 2017 at 10:30

1

Solved

What I have achieved so far? I'm using WireMock with Spring Boot Application using the JUNIT 5. I am stubbing the test endpoint with the custom Request and Response JSON payload: REQUEST PAYLOAD: {...
Vicechancellor asked 12/6, 2023 at 10:17

3

Solved

I am developing a Spring Boot application. For my regular service class unit tests, I am able to extend my test class with MockitoExtension, and the mocks are strict, which is what I want. interfac...
Zachar asked 27/10, 2021 at 20:11

9

Solved

I have a Spring Boot test that uses wiremock to mock an external service. In order to avoid conflicts with parallel builds I don't want to set a fixed port number for wiremock and would like to rel...
Hawsehole asked 9/2, 2018 at 14:2

2

Solved

I am creating my controller and controller advice like this: Test class: @RunWith(SpringRunner.class) @SpringBootTest public class TestController { private MockMvc mockMvc; @Mock private MyS...
Fantastically asked 17/9, 2017 at 22:55

3

Solved

I am trying to write integration test case for one of my rest application which uses mongodb internally to persist the data @DataMongoTest @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_...
Backblocks asked 2/4, 2019 at 11:51

4

I'm using springbooot 2.4.0 and I added the following dependencies for enabling prometheus metrics: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>sp...

5

I have a bare Spring Boot application @SpringBootApplication public class ClientApplication { public static void main(String[] args) { SpringApplication.run(ClientApplication.class, args); } } ...
Zaxis asked 8/8, 2021 at 16:3

2

Solved

I have an application with SpringBoot2 and Junit5, and now I'm trying to make a test. I have a this class called OrderService that looks like this: @Component public class OrderService { @Value(&qu...
Gore asked 21/10, 2018 at 19:57

5

I am using dependencies as below <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ...
Maje asked 26/10, 2017 at 6:53

© 2022 - 2024 — McMap. All rights reserved.