Skip to content

Commit 5367d6d

Browse files
committed
chore: removed unused code
1 parent a968da7 commit 5367d6d

File tree

5 files changed

+26
-27
lines changed

5 files changed

+26
-27
lines changed

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@
185185
<goal>report</goal>
186186
</goals>
187187
<configuration>
188+
<excludes>
189+
<exclude>**/br/com/grupo63/techchallenge/payment/api/controller/dto/PaymentStatusResponseDTO.class</exclude>
190+
<exclude>**/br/com/grupo63/techchallenge/payment/api/controller/dto/QRCodeResponseDTO.class</exclude>
191+
</excludes>
188192
<formats>
189193
<format>XML</format>
190194
</formats>

src/main/java/br/com/grupo63/techchallenge/payment/gateway/payment/IPaymentGateway.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package br.com.grupo63.techchallenge.payment.gateway.payment;
22

3-
import br.com.grupo63.techchallenge.common.gateway.IPersistenceEntityGateway;
43
import br.com.grupo63.techchallenge.payment.domain.Payment;
54

65
import java.util.Optional;
76

8-
public interface IPaymentGateway extends IPersistenceEntityGateway<Payment> {
7+
public interface IPaymentGateway {
98

109
Payment saveAndFlush(Payment payment);
1110

src/main/java/br/com/grupo63/techchallenge/payment/gateway/payment/PaymentJpaAdapter.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import lombok.RequiredArgsConstructor;
55
import org.springframework.stereotype.Component;
66

7-
import java.util.List;
87
import java.util.Optional;
98

109
@Component
@@ -13,11 +12,6 @@ public class PaymentJpaAdapter implements IPaymentGateway {
1312

1413
private final PaymentJpaRepository paymentJpaRepository;
1514

16-
@Override
17-
public List<Payment> findByDeletedFalse() {
18-
throw new UnsupportedOperationException("This operation is not supported.");
19-
}
20-
2115
@Override
2216
public Payment saveAndFlush(Payment payment) {
2317
PaymentPersistenceEntity entity = new PaymentPersistenceEntity(payment);
@@ -27,11 +21,6 @@ public Payment saveAndFlush(Payment payment) {
2721
return entity.toModel();
2822
}
2923

30-
@Override
31-
public Optional<Payment> findByIdAndDeletedFalse(Long id) {
32-
throw new UnsupportedOperationException("This operation is not supported.");
33-
}
34-
3524
@Override
3625
public Optional<Payment> findByOrderId(Long id) {
3726
return paymentJpaRepository.findByOrderId(id).map(PaymentPersistenceEntity::toModel);

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,10 @@
22

33
import br.com.grupo63.techchallenge.payment.api.controller.dto.PaymentStatusResponseDTO;
44
import br.com.grupo63.techchallenge.payment.api.controller.dto.QRCodeResponseDTO;
5-
import br.com.grupo63.techchallenge.payment.controller.dto.PaymentControllerDTO;
6-
import br.com.grupo63.techchallenge.payment.domain.Payment;
75
import br.com.grupo63.techchallenge.payment.domain.PaymentStatus;
86

97
public class PaymentPresenter {
108

11-
public static PaymentControllerDTO toDto(Payment entity) {
12-
PaymentControllerDTO dto = new PaymentControllerDTO();
13-
14-
dto.setId(entity.getId());
15-
dto.setStatus(entity.getStatus());
16-
dto.setMethod(entity.getMethod());
17-
dto.setQrData(entity.getQrData());
18-
19-
return dto;
20-
}
21-
229
public static QRCodeResponseDTO toDto(String qrCode) {
2310
return new QRCodeResponseDTO(qrCode);
2411
}

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,29 @@ public void testStartPayment_EndToEnd() {
8787
@Test
8888
public void testfinishPayment_EndToEnd() {
8989
when(paymentGateway.findByOrderId(defaultOrderId)).thenReturn(Optional.of(payment));
90-
when(paymentJpaRepository.save(any())).thenReturn(defaultPaymentPersistenceEntity);
9190

9291
ResponseEntity response = paymentAPIController.confirmPaymentFromOrderId(defaultOrderId);
9392
assertEquals(HttpStatus.OK, response.getStatusCode());
9493
}
94+
95+
// @SneakyThrows
96+
// @Test
97+
// public void testUpdate_EndToEnd() {
98+
// when(clientJpaRepository.findByIdAndDeletedFalse(defaultClientPersistenceEntity.getId())).thenReturn(Optional.of(defaultClientPersistenceEntity));
99+
//
100+
// ClientControllerDTO clientControllerDTO = new ClientControllerDTO();
101+
//
102+
// clientControllerDTO.setId(defaultClientPersistenceEntity.getId());
103+
// clientControllerDTO.setNationalId("11111111111");
104+
//
105+
// when(clientJpaRepository.save(any())).thenReturn(new ClientPersistenceEntity(defaultClientPersistenceEntity.getId(), defaultClientPersistenceEntity.isDeleted(), clientControllerDTO.getNationalId()));
106+
//
107+
// ResponseEntity<ClientControllerDTO> response = clientAPIController.update(clientControllerDTO, defaultClientPersistenceEntity.getId());
108+
//
109+
// assertEquals(HttpStatus.OK, response.getStatusCode());
110+
// assertNotNull(response.getBody());
111+
// assertEquals(response.getBody().getNationalId(), clientControllerDTO.getNationalId());
112+
// verify(clientJpaRepository, times(1)).findByIdAndDeletedFalse(any());
113+
// verify(clientJpaRepository, times(1)).save(any());
114+
// }
95115
}

0 commit comments

Comments
 (0)