1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/taskx/psmid/against-solution11/test/apifest/CurrencyTest.java Sat Oct 25 20:53:00 2008 +0200
1.3 @@ -0,0 +1,29 @@
1.4 +package apifest;
1.5 +
1.6 +import junit.framework.TestCase;
1.7 +import org.apidesign.apifest08.currency.Convertor;
1.8 +import org.apidesign.apifest08.currency.CurrencyValue;
1.9 +//import static org.apidesign.apifest08.test.Currencies.CZK;
1.10 +//import static org.apidesign.apifest08.test.Currencies.SKK;
1.11 +//import static org.apidesign.apifest08.test.Currencies.USD;
1.12 +
1.13 +/** Write a test that works with version from task A and fails with version B.
1.14 + */
1.15 +public class CurrencyTest extends TestCase {
1.16 + public CurrencyTest(String n) {
1.17 + super(n);
1.18 + }
1.19 +
1.20 + public void testCompatibility() throws Exception {
1.21 + try {
1.22 + Convertor c = Convertor.getConvertorIntegerString(
1.23 + CurrencyValue.getCurrencyValue(1, "CZK"),
1.24 + CurrencyValue.getCurrencyValue(1, "CZK")
1.25 + );
1.26 + c.convert("CZK", CurrencyValue.getCurrencyValue(10, "CZK"));
1.27 + fail("Should throw exception");
1.28 + } catch (IllegalArgumentException e) {
1.29 + //ok
1.30 + }
1.31 + }
1.32 +}