Skip to content

Commit 19d7d40

Browse files
committed
chore: added more coverage
1 parent 53a58d7 commit 19d7d40

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@
178178
<exclude>**/br/com/grupo63/techchallenge/payment/api/controller/dto/PaymentStatusResponseDTO.class</exclude>
179179
<exclude>**/br/com/grupo63/techchallenge/payment/api/controller/dto/QRCodeResponseDTO.class</exclude>
180180
<exclude>**/br/com/grupo63/techchallenge/payment/gateway/order/dto/OrderDTO.class</exclude>
181-
<exclude>**/br/com/grupo63/techchallenge/payment/gateway/payment/PaymentPersistenceEntity.class</exclude>
182181
<exclude>**/br/com/grupo63/techchallenge/payment/ServicePaymentApplication.class</exclude>
183182
</excludes>
184183
</configuration>

src/main/java/br/com/grupo63/techchallenge/payment/presenter/PaymentPresenter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
public class PaymentPresenter {
88

99
public static QRCodeResponseDTO toDto(String qrCode) {
10-
return new QRCodeResponseDTO(qrCode);
10+
QRCodeResponseDTO qrCodeResponseDTO = new QRCodeResponseDTO();
11+
12+
qrCodeResponseDTO.setQrData(qrCode);
13+
return qrCodeResponseDTO;
1114
}
1215

1316
public static PaymentStatusResponseDTO toDto(PaymentStatus status) {
14-
return new PaymentStatusResponseDTO(status);
17+
PaymentStatusResponseDTO dto = new PaymentStatusResponseDTO();
18+
19+
dto.setStatus(status);
20+
return dto;
1521
}
1622

1723

src/test/java/br/com/grupo63/techchallenge/payment/PaymentIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void testGetPaymentStatus_EndToEnd() {
7373
@SneakyThrows
7474
@Test
7575
void testStartPayment_EndToEnd() {
76-
when(paymentJpaRepository.save(any())).thenReturn(defaultPaymentPersistenceEntity);
76+
when(paymentJpaRepository.save(any())).thenReturn(new PaymentPersistenceEntity(qrData, defaultOrderId, PaymentMethod.MERCADO_PAGO_QR_CODE, PaymentStatus.PENDING));
7777
when(orderGateway.getOrderById(defaultOrderId)).thenReturn(Optional.of(orderDTO));
7878

7979
ResponseEntity<QRCodeResponseDTO> response = paymentAPIController.startPayment(defaultOrderId);
@@ -83,7 +83,7 @@ void testStartPayment_EndToEnd() {
8383

8484
@SneakyThrows
8585
@Test
86-
void testfinishPayment_EndToEnd() {
86+
void testFinishPayment_EndToEnd() {
8787
when(paymentJpaRepository.findByOrderId(defaultOrderId)).thenReturn(Optional.of(defaultPaymentPersistenceEntity));
8888

8989
payment.setStatus(PaymentStatus.PAID);

0 commit comments

Comments
 (0)