/** * Get the provider of this rate. The provider of a rate can have different * contexts in different usage scenarios, such as the service type or the * stock exchange. * * @return the provider, or {code null}. */ public String getProviderName() { return getText("provider"); }
/** * Ensure additional ConversionContext is passed correctly to SPIs.<p> * Hint: this assertion will require some custom SPIs to be registered and selected for chain inclusion! */ @Test(description = "4.3.3 Ensure additional ConversionQuery data is passed correctly to SPIs.") @SpecAssertion(id = "433-A2", section = "4.3.3") public void testPassingOverConversionContextToSPIs() { ExchangeRateProvider prov = MonetaryConversions.getExchangeRateProvider("TestRateProvider"); ConversionQuery ctx = ConversionQueryBuilder.of().set(Locale.CANADA).set("Foo", "bar").setBaseCurrency(FOO_UNIT) .setTermCurrency(Monetary.getCurrency("XXX")).build(); ExchangeRate rate = prov.getExchangeRate(ctx); AssertJUnit.assertNotNull("No test rate returned by getExchangeRate(ConversionQuery), " + "probably TestProvider is not correct registered."); AssertJUnit.assertEquals( "Text parameter Locale.class was not correctly passed to ExchangeRateProvider implementation.", "bar", rate.getContext().getText("Foo")); AssertJUnit.assertEquals( "Object parameter Locale.class was not correctly passed to ExchangeRateProvider implementation.", Locale.CANADA, rate.getContext().get(Locale.class)); }