code: void addRate(CurrencyUnit term, LocalDate localDate, Number rate) {
          RateType rateType = RateType.HISTORIC;
          ExchangeRateBuilder builder;
          if (Objects.nonNull(localDate)) {
              // TODO check/test!
              if (localDate.equals(LocalDate.now())) {
                  rateType = RateType.DEFERRED;
              }
              builder = new ExchangeRateBuilder(
                      ConversionContextBuilder.create(context, rateType).set(localDate).build());
          } else {
              builder = new ExchangeRateBuilder(ConversionContextBuilder.create(context, rateType).build());
          }
          builder.setBase(ECBHistoricRateProvider.BASE_CURRENCY);
          builder.setTerm(term);
          builder.setFactor(DefaultNumberValue.of(rate));
          ExchangeRate exchangeRate = builder.build();
          Map<String, ExchangeRate> rateMap = this.historicRates.get(localDate);
          if (Objects.isNull(rateMap)) {
              synchronized (this.historicRates) {
                  rateMap = Optional.ofNullable(this.historicRates.get(localDate)).orElse(new ConcurrentHashMap<>());
                  this.historicRates.putIfAbsent(localDate, rateMap);
  
              }
          }
          rateMap.put(term.getCurrencyCode(), exchangeRate);
      }
docs: Method to add a currency exchange rate.
  
  @param term      the term (target) currency, mapped from EUR.
  @param rate      The rate.