refactor(workshop): drop historical currency conversion exercises

Remove tasks depending on ECB-HIST as historical rate queries
are inconsistent and environment-dependent.
This commit is contained in:
Marcus Fihlon 2026-04-20 00:18:14 +02:00
parent e7e8662414
commit e8162f3f17
Signed by: McPringle
GPG key ID: C6B7F469EE363E1F
2 changed files with 5 additions and 52 deletions

View file

@ -1,6 +1,5 @@
package swiss.fihlon.workshop.money.part2;
import java.time.LocalDateTime;
import javax.money.MonetaryAmount;
import javax.money.convert.CurrencyConversion;
@ -35,29 +34,4 @@ public class CurrencyConversionExercises {
public MonetaryAmount convertChfToEur(MonetaryAmount amount) {
throw new UnsupportedOperationException("TODO");
}
/**
* <p>Create a currency conversion to EUR using a timestamp-based conversion query.</p>
*
* <p>Include the given {@link LocalDateTime} in the query.</p>
*
* @param timestamp timestamp used in the conversion query
* @return currency conversion to EUR for the given timestamp
*/
public CurrencyConversion getEurConversionForTimestamp(LocalDateTime timestamp) {
throw new UnsupportedOperationException("TODO");
}
/**
* <p>Convert a CHF amount to EUR using a timestamp-based conversion query.</p>
*
* <p>Build the conversion query with the given timestamp and return the converted amount.</p>
*
* @param amount amount in CHF
* @param timestamp timestamp used in the conversion query
* @return converted amount in EUR
*/
public MonetaryAmount convertChfToEurAt(MonetaryAmount amount, LocalDateTime timestamp) {
throw new UnsupportedOperationException("TODO");
}
}

View file

@ -1,13 +1,13 @@
package swiss.fihlon.workshop.money.part2;
import static org.assertj.core.api.Assertions.assertThat;
import java.time.LocalDateTime;
import javax.money.MonetaryAmount;
import javax.money.convert.CurrencyConversion;
import org.javamoney.moneta.Money;
import org.junit.jupiter.api.Test;
import javax.money.MonetaryAmount;
import javax.money.convert.CurrencyConversion;
import static org.assertj.core.api.Assertions.assertThat;
class CurrencyConversionExercisesTest {
private final CurrencyConversionExercises exercises = new CurrencyConversionExercises();
@ -29,25 +29,4 @@ class CurrencyConversionExercisesTest {
assertThat(result).isNotNull();
assertThat(result.getCurrency().getCurrencyCode()).isEqualTo("EUR");
}
@Test
void shouldCreateEurConversionForTimestamp() {
LocalDateTime timestamp = LocalDateTime.of(2024, 1, 15, 10, 30);
CurrencyConversion conversion = exercises.getEurConversionForTimestamp(timestamp);
assertThat(conversion).isNotNull();
assertThat(conversion.getCurrency().getCurrencyCode()).isEqualTo("EUR");
}
@Test
void shouldConvertChfToEurAtTimestamp() {
MonetaryAmount chfAmount = Money.of(10, "CHF");
LocalDateTime timestamp = LocalDateTime.of(2024, 1, 15, 10, 30);
MonetaryAmount result = exercises.convertChfToEurAt(chfAmount, timestamp);
assertThat(result).isNotNull();
assertThat(result.getCurrency().getCurrencyCode()).isEqualTo("EUR");
}
}