Skip to content

Commit

Permalink
Merge pull request #75 from NashTech-Labs/feature/Update-payment-serv…
Browse files Browse the repository at this point in the history
…ice-structure

Update Payment Service Project Structure
  • Loading branch information
ankit-mogha authored Jan 16, 2024
2 parents a85676d + 1819ca0 commit e33d65c
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 67 deletions.
8 changes: 8 additions & 0 deletions payment-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-test</artifactId>
<version>4.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -115,6 +121,7 @@
<exclude>**/*model*/**</exclude>
<exclude>**/*Application*</exclude>
<exclude>**/*entity*/**</exclude>
<exclude>**/*data*/**</exclude>
<exclude>**/resources/**</exclude>
</excludes>
</configuration>
Expand Down Expand Up @@ -186,6 +193,7 @@
**/*common*/**,
**/*constant*/**,
**/*model*/**,
**/*data*/**,
**/*Application.*
</sonar.coverage.exclusions>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package com.nashtech.payment;

/*
import org.springframework.boot.test.context.SpringBootTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,61 @@
import com.nashtech.common.event.PaymentCancelledEvent;
import com.nashtech.common.model.PaymentDetails;
import com.nashtech.common.model.User;
import org.junit.jupiter.api.Disabled;
import org.axonframework.test.aggregate.AggregateTestFixture;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class PaymentAggregateTest {

private AggregateTestFixture<PaymentAggregate> fixture;

@BeforeEach
void setUp() {
fixture = new AggregateTestFixture<>(PaymentAggregate.class);
}

@Test
void testShipmentAggregateCreation() {

ProcessPaymentCommand processPaymentCommand = ProcessPaymentCommand.builder()
.basePrice(10.0d)
.brand("Brand")
.orderId("42")
.paymentId("42")
.productId("42")
.quantity(1)
.subTotal(10.0d)
.tax(10.0f)
.total(10.0d)
.totalTax(10.0f)
.userId("1652")
.build();

PaymentApprovedEvent paymentApprovedEvent = PaymentApprovedEvent.builder()
.basePrice(10.0d)
.brand("Brand")
.orderId("42")
.paymentId("42")
.productId("42")
.quantity(1)
.subTotal(10.0d)
.tax(10.0f)
.total(10.0d)
.totalTax(10.0f)
.user(User.builder()
.userId("1652")
.firstName("Abid")
.lastName("Khan")
.address("Noida")
.emailId("[email protected]")
.mobileNumber("9087658765")
.build()).build();

fixture.givenNoPriorActivity()
.when(processPaymentCommand)
.expectEvents(paymentApprovedEvent);
}

/**
* Method under test:
* {@link PaymentAggregate#buildPaymentCancelEvent(ProcessPaymentCommand, String)}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.mockito.MockitoAnnotations;

@Slf4j
public class PaymentsEventHandlerTest {
class PaymentsEventHandlerTest {
@Mock
private PaymentsRepository paymentsRepository;

Expand All @@ -24,7 +24,7 @@ public void setUp() {
}

@Test
public void testPaymentApprovedEventHandling() {
void testPaymentApprovedEventHandling() {
// Given
PaymentApprovedEvent paymentApprovedEvent = PaymentApprovedEvent.builder().build();

Expand Down

0 comments on commit e33d65c

Please sign in to comment.