forked from pierront/mylibrary-template
Feature/create subscription #3
+7
-7
@@ -25,9 +25,9 @@ public class SubscriptionConverterTest {
|
||||
void shouldConvertSubscriptionInfoToDomain() {
|
||||
// Given
|
||||
PaymentMethodInfo paymentMethodInfo = new PaymentMethodInfo(PaymentType.CB.name(), "Maxime Lebreton");
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24);
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
|
||||
SubscriptionInfo subscriptionInfo = new SubscriptionInfo(SubscriptionDurationDesired.THREE.getValue(), desiredStartDate);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
|
||||
|
||||
// When
|
||||
Subscription result = SubscriptionConverter.toDomain(subscriptionInfo, paymentMethodInfo);
|
||||
@@ -55,8 +55,8 @@ public class SubscriptionConverterTest {
|
||||
.paymentType(PaymentType.CB.name())
|
||||
.details("Maxime Lebreton")
|
||||
.build();
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
|
||||
Subscription subscription = Subscription.builder()
|
||||
.subscriptionId(UUID.randomUUID())
|
||||
.customerId(UUID.randomUUID())
|
||||
@@ -90,8 +90,8 @@ public class SubscriptionConverterTest {
|
||||
.paymentType(PaymentType.CB.name())
|
||||
.details(null)
|
||||
.build();
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
|
||||
Subscription subscription = Subscription.builder()
|
||||
.subscriptionId(UUID.randomUUID())
|
||||
.customerId(UUID.randomUUID())
|
||||
@@ -114,7 +114,7 @@ public class SubscriptionConverterTest {
|
||||
@DisplayName("Should preserve empty string values during conversion")
|
||||
void shouldPreserveEmptyStrings() {
|
||||
PaymentMethodInfo paymentMethodInfo = new PaymentMethodInfo(PaymentType.CB.name(), "");
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24);
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
|
||||
SubscriptionInfo subscriptionInfo = new SubscriptionInfo(SubscriptionDurationDesired.THREE.getValue(), desiredStartDate);
|
||||
|
||||
Subscription domainResult = SubscriptionConverter.toDomain(subscriptionInfo, paymentMethodInfo);
|
||||
|
||||
+7
-7
@@ -22,9 +22,9 @@ public class SubscriptionTest {
|
||||
String paymentType = PaymentType.CB.name();
|
||||
Object details = new Object();
|
||||
details = "Maxime Lebreton";
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24);
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate startDate = desiredStartDate;
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
|
||||
double monthlyAmount = 17.99;
|
||||
|
||||
PaymentMethod paymentMethod = PaymentMethod.builder()
|
||||
@@ -80,7 +80,7 @@ public class SubscriptionTest {
|
||||
@Test
|
||||
@DisplayName("setStartDate should instantiate StartDate as the same value as the variable desiredStartDate")
|
||||
void testSetStartDate() {
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24);
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
|
||||
Subscription subscription = Subscription.builder()
|
||||
.desiredStartDate(desiredStartDate)
|
||||
.build();
|
||||
@@ -94,8 +94,8 @@ public class SubscriptionTest {
|
||||
@Test
|
||||
@DisplayName("setEndDate should instantiate EndDate as the same value as the variable desiredStartDate + subscriptionDurationDesired")
|
||||
void testSetEndDate() {
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
|
||||
Subscription subscription = Subscription.builder()
|
||||
.subscriptionDurationDesired(SubscriptionDurationDesired.THREE.getValue())
|
||||
.desiredStartDate(desiredStartDate)
|
||||
@@ -110,8 +110,8 @@ public class SubscriptionTest {
|
||||
@Test
|
||||
@DisplayName("setDateSubscription should instantiate StartDate and EndDate ")
|
||||
void testSetDateSubscription() {
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
|
||||
LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
|
||||
Subscription subscription = Subscription.builder()
|
||||
.subscriptionDurationDesired(SubscriptionDurationDesired.THREE.getValue())
|
||||
.desiredStartDate(desiredStartDate)
|
||||
|
||||
Reference in New Issue
Block a user