@@ -38,7 +38,7 @@ public class ConvertingAmountsTest{
3838 * must be also implemented and registered as an SPI.
3939 */
4040 @ Test (description = "4.3.2 Test successful conversion for CHF -> FOO, using TestRateProvider." )
41- @ SpecAssertion (id = "432-A1" , section = "4.3.2" )
41+ @ SpecAssertion (id = "432-A1" , section = "4.3.2" )
4242 public void testConversion (){
4343 CurrencyUnit cu = new TestCurrencyUnit ("FOO" );
4444 CurrencyConversion conv = MonetaryConversions .getConversion (cu , "TestRateProvider" );
@@ -55,24 +55,27 @@ public void testConversion(){
5555 * Compare conversions done with exchange rates provided for same currency pair.
5656 */
5757 @ Test (description = "4.3.2 Test correct ExchangeRate is returned for CHF -> FOO, using TestRateProvider." )
58- @ SpecAssertion (id = "432-A2" , section = "4.3.2" )
58+ @ SpecAssertion (id = "432-A2" , section = "4.3.2" )
5959 public void testConversionComparedWithRate (){
6060 final CurrencyUnit FOO = new TestCurrencyUnit ("FOO" );
61- ExchangeRate rate = MonetaryConversions .getExchangeRateProvider ("TestRateProvider" ). getExchangeRate (
62- MonetaryCurrencies .getCurrency ("CHF" ), FOO );
63- AssertJUnit .assertEquals (rate .getBase (), MonetaryCurrencies .getCurrency ("CHF" ));
64- AssertJUnit .assertEquals (rate .getTerm ().getCurrencyCode (), FOO .getCurrencyCode ());
61+ ExchangeRate rate = MonetaryConversions .getExchangeRateProvider ("TestRateProvider" )
62+ . getExchangeRate ( MonetaryCurrencies .getCurrency ("CHF" ), FOO );
63+ AssertJUnit .assertEquals (rate .getBaseCurrency (), MonetaryCurrencies .getCurrency ("CHF" ));
64+ AssertJUnit .assertEquals (rate .getCurrency ().getCurrencyCode (), FOO .getCurrencyCode ());
6565 AssertJUnit .assertEquals (rate .getFactor ().intValueExact (), 2 );
6666 AssertJUnit .assertEquals ("TestRateProvider" , rate .getConversionContext ().getProvider ());
6767 }
6868
6969 /**
70- * Bad case: try converting from/to an inconvertible (custom) currency, ensure CurrencyConversionException is thrown.
71- * @see org.javamoney.tck.tests.internal.TestCurrencyUnit } for creating a custom currency, with some fancy non-ISO currency code.
70+ * Bad case: try converting from/to an inconvertible (custom) currency, ensure CurrencyConversionException is
71+ * thrown.
72+ *
73+ * @see org.javamoney.tck.tests.internal.TestCurrencyUnit } for creating a custom currency,
74+ * with some fancy non-ISO currency code.
7275 */
73- @ Test (description = "4.3.2 Bad case: Try CurrencyConversion to an inconvertible (custom) " +
76+ @ Test (description = "4.3.2 Bad case: Try CurrencyConversion to an inconvertible (custom) " +
7477 "currency (FOOANY), ensure CurrencyConversionException is thrown." )
75- @ SpecAssertion (id = "432-A3" , section = "4.3.2" )
78+ @ SpecAssertion (id = "432-A3" , section = "4.3.2" )
7679 public void testUnsupportedConversion (){
7780 MonetaryAmount m = MonetaryAmounts .getDefaultAmountFactory ().setNumber (10 ).setCurrency ("CHF" ).create ();
7881 CurrencyUnit cu = new TestCurrencyUnit ("FOOANY" );
@@ -81,30 +84,30 @@ public void testUnsupportedConversion(){
8184 m .with (conv );
8285 }
8386 catch (CurrencyConversionException e ){
84- // expected
87+ // expected
8588 }
8689 }
8790
8891 /**
8992 * Bad case: try converting from/to a null currency, ensure NullPointerException is thrown.
9093 */
91- @ Test (expectedExceptions = NullPointerException .class ,
92- description = "4.3.2 Bad case: Access CurrencyConversion " +
93- "with a CurrencyUnit==null, ensure NullPointerException is thrown." )
94- @ SpecAssertion (id = "432-A4" , section = "4.3.2" )
94+ @ Test (expectedExceptions = NullPointerException .class ,
95+ description = "4.3.2 Bad case: Access CurrencyConversion " +
96+ "with a CurrencyUnit==null, ensure NullPointerException is thrown." )
97+ @ SpecAssertion (id = "432-A4" , section = "4.3.2" )
9598 public void testNullConversion1 (){
96- MonetaryConversions .getConversion ((CurrencyUnit )null );
99+ MonetaryConversions .getConversion ((CurrencyUnit ) null );
97100 }
98101
99102 /**
100103 * Bad case: try converting from/to a null currency, ensure NullPointerException is thrown.
101104 */
102- @ Test (expectedExceptions = NullPointerException .class ,
103- description = "4.3.2 Bad case: Access CurrencyConversion with a currency code==null, ensure " +
104- "NullPointerException is thrown." )
105- @ SpecAssertion (id = "432-A4" , section = "4.3.2" )
105+ @ Test (expectedExceptions = NullPointerException .class ,
106+ description = "4.3.2 Bad case: Access CurrencyConversion with a currency code==null, ensure " +
107+ "NullPointerException is thrown." )
108+ @ SpecAssertion (id = "432-A4" , section = "4.3.2" )
106109 public void testNullConversion2 (){
107- MonetaryConversions .getConversion ((String )null );
110+ MonetaryConversions .getConversion ((String ) null );
108111 }
109112
110113}
0 commit comments