mise à jour pour correspondre avec le fait que la date désiré de début d'abonnement doit être le jour même ou plus tard

This commit is contained in:
2026-06-13 22:41:47 +02:00
parent 5d5945b48b
commit 2a6db59950
2 changed files with 14 additions and 14 deletions
@@ -25,9 +25,9 @@ public class SubscriptionConverterTest {
void shouldConvertSubscriptionInfoToDomain() { void shouldConvertSubscriptionInfoToDomain() {
// Given // Given
PaymentMethodInfo paymentMethodInfo = new PaymentMethodInfo(PaymentType.CB.name(), "Maxime Lebreton"); 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); SubscriptionInfo subscriptionInfo = new SubscriptionInfo(SubscriptionDurationDesired.THREE.getValue(), desiredStartDate);
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24); LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
// When // When
Subscription result = SubscriptionConverter.toDomain(subscriptionInfo, paymentMethodInfo); Subscription result = SubscriptionConverter.toDomain(subscriptionInfo, paymentMethodInfo);
@@ -55,8 +55,8 @@ public class SubscriptionConverterTest {
.paymentType(PaymentType.CB.name()) .paymentType(PaymentType.CB.name())
.details("Maxime Lebreton") .details("Maxime Lebreton")
.build(); .build();
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24); LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24); LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
Subscription subscription = Subscription.builder() Subscription subscription = Subscription.builder()
.subscriptionId(UUID.randomUUID()) .subscriptionId(UUID.randomUUID())
.customerId(UUID.randomUUID()) .customerId(UUID.randomUUID())
@@ -90,8 +90,8 @@ public class SubscriptionConverterTest {
.paymentType(PaymentType.CB.name()) .paymentType(PaymentType.CB.name())
.details(null) .details(null)
.build(); .build();
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24); LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24); LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
Subscription subscription = Subscription.builder() Subscription subscription = Subscription.builder()
.subscriptionId(UUID.randomUUID()) .subscriptionId(UUID.randomUUID())
.customerId(UUID.randomUUID()) .customerId(UUID.randomUUID())
@@ -114,7 +114,7 @@ public class SubscriptionConverterTest {
@DisplayName("Should preserve empty string values during conversion") @DisplayName("Should preserve empty string values during conversion")
void shouldPreserveEmptyStrings() { void shouldPreserveEmptyStrings() {
PaymentMethodInfo paymentMethodInfo = new PaymentMethodInfo(PaymentType.CB.name(), ""); 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); SubscriptionInfo subscriptionInfo = new SubscriptionInfo(SubscriptionDurationDesired.THREE.getValue(), desiredStartDate);
Subscription domainResult = SubscriptionConverter.toDomain(subscriptionInfo, paymentMethodInfo); Subscription domainResult = SubscriptionConverter.toDomain(subscriptionInfo, paymentMethodInfo);
@@ -22,9 +22,9 @@ public class SubscriptionTest {
String paymentType = PaymentType.CB.name(); String paymentType = PaymentType.CB.name();
Object details = new Object(); Object details = new Object();
details = "Maxime Lebreton"; details = "Maxime Lebreton";
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24); LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
LocalDate startDate = desiredStartDate; LocalDate startDate = desiredStartDate;
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24); LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
double monthlyAmount = 17.99; double monthlyAmount = 17.99;
PaymentMethod paymentMethod = PaymentMethod.builder() PaymentMethod paymentMethod = PaymentMethod.builder()
@@ -80,7 +80,7 @@ public class SubscriptionTest {
@Test @Test
@DisplayName("setStartDate should instantiate StartDate as the same value as the variable desiredStartDate") @DisplayName("setStartDate should instantiate StartDate as the same value as the variable desiredStartDate")
void testSetStartDate() { void testSetStartDate() {
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24); LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
Subscription subscription = Subscription.builder() Subscription subscription = Subscription.builder()
.desiredStartDate(desiredStartDate) .desiredStartDate(desiredStartDate)
.build(); .build();
@@ -94,8 +94,8 @@ public class SubscriptionTest {
@Test @Test
@DisplayName("setEndDate should instantiate EndDate as the same value as the variable desiredStartDate + subscriptionDurationDesired") @DisplayName("setEndDate should instantiate EndDate as the same value as the variable desiredStartDate + subscriptionDurationDesired")
void testSetEndDate() { void testSetEndDate() {
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24); LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24); LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
Subscription subscription = Subscription.builder() Subscription subscription = Subscription.builder()
.subscriptionDurationDesired(SubscriptionDurationDesired.THREE.getValue()) .subscriptionDurationDesired(SubscriptionDurationDesired.THREE.getValue())
.desiredStartDate(desiredStartDate) .desiredStartDate(desiredStartDate)
@@ -110,8 +110,8 @@ public class SubscriptionTest {
@Test @Test
@DisplayName("setDateSubscription should instantiate StartDate and EndDate ") @DisplayName("setDateSubscription should instantiate StartDate and EndDate ")
void testSetDateSubscription() { void testSetDateSubscription() {
LocalDate desiredStartDate = LocalDate.of(2026, 3, 24); LocalDate desiredStartDate = LocalDate.of(2026, 6, 24);
LocalDate estimateEndDate = LocalDate.of(2026, 6, 24); LocalDate estimateEndDate = LocalDate.of(2026, 9, 24);
Subscription subscription = Subscription.builder() Subscription subscription = Subscription.builder()
.subscriptionDurationDesired(SubscriptionDurationDesired.THREE.getValue()) .subscriptionDurationDesired(SubscriptionDurationDesired.THREE.getValue())
.desiredStartDate(desiredStartDate) .desiredStartDate(desiredStartDate)