From 9169eae6f6a90c937d2ad75839cda571d31e366a Mon Sep 17 00:00:00 2001 From: Lou Andria Date: Wed, 11 Sep 2024 16:55:04 +0200 Subject: [PATCH] fix: Devise rate: EUR and CAD take value over time against MGA, not the converse --- src/main/java/school/hei/patrimoine/modele/Devise.java | 4 ++-- .../school/hei/patrimoine/cas/PatrimoineDeZetyTest.java | 2 +- .../java/school/hei/patrimoine/modele/ArgentTest.java | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/school/hei/patrimoine/modele/Devise.java b/src/main/java/school/hei/patrimoine/modele/Devise.java index 39255ccd..7c8c7ea9 100644 --- a/src/main/java/school/hei/patrimoine/modele/Devise.java +++ b/src/main/java/school/hei/patrimoine/modele/Devise.java @@ -12,9 +12,9 @@ public record Devise( implements Serializable { public static final Devise MGA = new Devise("ARIARY", "Ar", LocalDate.MIN, 1, 0.0); public static final Devise EUR = - new Devise("EURO", "€", LocalDate.of(2024, JULY, 3), 4_821, -0.1); + new Devise("EURO", "€", LocalDate.of(2024, JULY, 3), 4_821, 0.03); public static final Devise CAD = - new Devise("CAD", "CAD", LocalDate.of(2024, JULY, 8), 3_286, -0.1); + new Devise("CAD", "CAD", LocalDate.of(2024, JULY, 8), 3_286, 0.03); public double valeurEnAriary(LocalDate now) { var joursEcoules = DAYS.between(t, now); diff --git a/src/test/java/school/hei/patrimoine/cas/PatrimoineDeZetyTest.java b/src/test/java/school/hei/patrimoine/cas/PatrimoineDeZetyTest.java index 89afcb7c..ad003b50 100644 --- a/src/test/java/school/hei/patrimoine/cas/PatrimoineDeZetyTest.java +++ b/src/test/java/school/hei/patrimoine/cas/PatrimoineDeZetyTest.java @@ -103,6 +103,6 @@ void zety_part_en_Allemagne() { var patrimoineDeZetyLe14Fevrier2025 = patrimoineDeZetyLe26Octobre2025().projectionFuture(AU_26_OCTOBRE_2025); - assertEquals(euro(-9_964), patrimoineDeZetyLe14Fevrier2025.getValeurComptable(EUR)); + assertEquals(euro(-9_477), patrimoineDeZetyLe14Fevrier2025.getValeurComptable(EUR)); } } diff --git a/src/test/java/school/hei/patrimoine/modele/ArgentTest.java b/src/test/java/school/hei/patrimoine/modele/ArgentTest.java index 2aea1153..cbdf3553 100644 --- a/src/test/java/school/hei/patrimoine/modele/ArgentTest.java +++ b/src/test/java/school/hei/patrimoine/modele/ArgentTest.java @@ -15,10 +15,11 @@ class ArgentTest { void eur_to_mga() { var t = LocalDate.of(2024, SEPTEMBER, 1); - assertEquals(ariary(4_741), euro(1).convertir(MGA, t)); - assertEquals(ariary(9_482), euro(2).convertir(MGA, t)); - assertEquals(ariary(7_554), euro(2).convertir(MGA, t.plusYears(2))); - assertEquals(ariary(11_414), euro(2).convertir(MGA, t.minusYears(2))); + assertEquals(ariary(4_844), euro(1).convertir(MGA, t)); + assertEquals(ariary(4_989), euro(1).convertir(MGA, t.plusYears(1))); + assertEquals(ariary(9_688), euro(2).convertir(MGA, t)); + assertEquals(ariary(10_268), euro(2).convertir(MGA, t.plusYears(2))); + assertEquals(ariary(9_110), euro(2).convertir(MGA, t.minusYears(2))); } @Test