Skip to content

Commit b1fd77a

Browse files
author
ALIOTTI Simon
committed
feat: E2E, UT
1 parent 9e41802 commit b1fd77a

45 files changed

Lines changed: 840 additions & 103 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<java.version>25</java.version>
1919
<apache.commons.collections4.version>4.5.0</apache.commons.collections4.version>
2020
<mapstruct.version>1.6.3</mapstruct.version>
21+
<org.test.containers.postgresql.version>1.21.4</org.test.containers.postgresql.version>
2122
</properties>
2223

2324
<dependencies>
@@ -80,13 +81,45 @@
8081
<artifactId>mapstruct</artifactId>
8182
<version>${mapstruct.version}</version>
8283
</dependency>
83-
8484
<!-- Tools dependencies -->
85+
86+
<!-- Test dependencies -->
8587
<dependency>
8688
<groupId>org.springframework.boot</groupId>
8789
<artifactId>spring-boot-starter-test</artifactId>
8890
<scope>test</scope>
8991
</dependency>
92+
<!-- Contains testwebclient dep -->
93+
<dependency>
94+
<groupId>org.springframework.boot</groupId>
95+
<artifactId>spring-boot-starter-webflux-test</artifactId>
96+
<scope>test</scope>
97+
</dependency>
98+
<dependency>
99+
<groupId>org.testcontainers</groupId>
100+
<artifactId>postgresql</artifactId>
101+
<version>${org.test.containers.postgresql.version}</version>
102+
<scope>test</scope>
103+
</dependency>
104+
<dependency>
105+
<groupId>org.testcontainers</groupId>
106+
<artifactId>junit-jupiter</artifactId>
107+
<version>${org.test.containers.postgresql.version}</version>
108+
<scope>test</scope>
109+
</dependency>
110+
<dependency>
111+
<groupId>org.wiremock.integrations</groupId>
112+
<artifactId>wiremock-spring-boot</artifactId>
113+
<version>4.0.9</version>
114+
<scope>test</scope>
115+
</dependency>
116+
<dependency>
117+
<groupId>org.springframework.boot</groupId>
118+
<artifactId>spring-boot-starter-webmvc-test</artifactId>
119+
<scope>test</scope>
120+
</dependency>
121+
<!-- Test dependencies -->
122+
90123
</dependencies>
91124

92125
<build>
@@ -130,7 +163,25 @@
130163
</excludes>
131164
</configuration>
132165
</plugin>
166+
<!-- Failsafe pour IT / E2E -->
167+
<plugin>
168+
<artifactId>maven-failsafe-plugin</artifactId>
169+
<version>3.2.5</version>
170+
<executions>
171+
<execution>
172+
<goals>
173+
<goal>integration-test</goal>
174+
<goal>verify</goal>
175+
</goals>
176+
</execution>
177+
</executions>
178+
<configuration>
179+
<includes>
180+
<include>**/*E2E.*</include>
181+
<include>**/*IT.*</include>
182+
</includes>
183+
</configuration>
184+
</plugin>
133185
</plugins>
134186
</build>
135-
136187
</project>

src/main/java/com/demo/tuto/test/CryptoApplication.java renamed to src/main/java/com/demo/tuto/crypto/CryptoApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.demo.tuto.test;
1+
package com.demo.tuto.crypto;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;

src/main/java/com/demo/tuto/test/configuration/LogExecutionTime.java renamed to src/main/java/com/demo/tuto/crypto/configuration/LogExecutionTime.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.demo.tuto.test.configuration;
1+
package com.demo.tuto.crypto.configuration;
22

33
import java.lang.annotation.ElementType;
44
import java.lang.annotation.Retention;

src/main/java/com/demo/tuto/test/configuration/SecurityConfig.java renamed to src/main/java/com/demo/tuto/crypto/configuration/SecurityConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.demo.tuto.test.configuration;
1+
package com.demo.tuto.crypto.configuration;
22

33
import org.springframework.context.annotation.Bean;
44
import org.springframework.context.annotation.Configuration;

src/main/java/com/demo/tuto/test/configuration/WebclientConfig.java renamed to src/main/java/com/demo/tuto/crypto/configuration/WebclientConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.demo.tuto.test.configuration;
1+
package com.demo.tuto.crypto.configuration;
22

33
import io.netty.channel.ChannelOption;
44
import io.netty.handler.timeout.ReadTimeoutHandler;
@@ -22,7 +22,7 @@ public class WebclientConfig {
2222

2323
private final String apikey;
2424

25-
public WebclientConfig(@Value("${client.service.api.coingecko.apikey}") final String apikey) {
25+
public WebclientConfig(@Value("${client.service.api.coingecko.apikey:}") final String apikey) {
2626
this.apikey = apikey;
2727
}
2828

src/main/java/com/demo/tuto/test/controller/CryptoController.java renamed to src/main/java/com/demo/tuto/crypto/controller/CryptoController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package com.demo.tuto.test.controller;
1+
package com.demo.tuto.crypto.controller;
22

3-
import com.demo.tuto.test.dto.CoinPriceResponse;
4-
import com.demo.tuto.test.dto.SimpleCoinPriceResponse;
5-
import com.demo.tuto.test.exception.CryptoException;
6-
import com.demo.tuto.test.service.CryptoService;
3+
import com.demo.tuto.crypto.dto.CoinPriceResponse;
4+
import com.demo.tuto.crypto.dto.SimpleCoinPriceResponse;
5+
import com.demo.tuto.crypto.exception.CryptoException;
6+
import com.demo.tuto.crypto.service.CryptoService;
77
import jakarta.validation.constraints.Max;
88
import jakarta.validation.constraints.Min;
99
import org.springframework.http.ResponseEntity;

src/main/java/com/demo/tuto/test/dao/CryptoDao.java renamed to src/main/java/com/demo/tuto/crypto/dao/CryptoDao.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

2-
package com.demo.tuto.test.dao;
2+
package com.demo.tuto.crypto.dao;
33

4-
import com.demo.tuto.test.entity.Crypto;
5-
import com.demo.tuto.test.model.CoinMarketData;
6-
import com.demo.tuto.test.pojo.CoinPrice;
7-
import com.demo.tuto.test.repository.CryptoRepository;
4+
import com.demo.tuto.crypto.entity.Crypto;
5+
import com.demo.tuto.crypto.model.CoinMarketData;
6+
import com.demo.tuto.crypto.pojo.CoinPrice;
7+
import com.demo.tuto.crypto.repository.CryptoRepository;
88
import jakarta.persistence.EntityManager;
99
import jakarta.persistence.PersistenceContext;
1010
import jakarta.transaction.Transactional;

src/main/java/com/demo/tuto/test/dto/CoinPriceResponse.java renamed to src/main/java/com/demo/tuto/crypto/dto/CoinPriceResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.demo.tuto.test.dto;
1+
package com.demo.tuto.crypto.dto;
22

33
import java.math.BigDecimal;
44
import java.time.LocalDateTime;

src/main/java/com/demo/tuto/test/dto/SimpleCoinPriceResponse.java renamed to src/main/java/com/demo/tuto/crypto/dto/SimpleCoinPriceResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.demo.tuto.test.dto;
1+
package com.demo.tuto.crypto.dto;
22

33
import java.math.BigDecimal;
44
import java.time.LocalDateTime;

src/main/java/com/demo/tuto/test/entity/Crypto.java renamed to src/main/java/com/demo/tuto/crypto/entity/Crypto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.demo.tuto.test.entity;
1+
package com.demo.tuto.crypto.entity;
22

33
import jakarta.persistence.Entity;
44
import jakarta.persistence.GeneratedValue;

0 commit comments

Comments
 (0)