taskx/jtulach/against-solution02/test/apifest/CurrencyTest.java
changeset 73 e8b0f13fd4fb
child 81 ec70f883de4a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/taskx/jtulach/against-solution02/test/apifest/CurrencyTest.java	Sat Oct 11 13:25:34 2008 +0200
     1.3 @@ -0,0 +1,30 @@
     1.4 +package apifest;
     1.5 +
     1.6 +import java.math.BigDecimal;
     1.7 +import java.util.Currency;
     1.8 +import junit.framework.TestCase;
     1.9 +import org.apidesign.apifest08.currency.Convertor;
    1.10 +import org.apidesign.apifest08.currency.ConvertorFactory;
    1.11 +import org.apidesign.apifest08.currency.Money;
    1.12 +
    1.13 +
    1.14 +/** Write a test that works with version from task A and fails with version B.
    1.15 + */
    1.16 +public class CurrencyTest extends TestCase {
    1.17 +    public CurrencyTest(String n) {
    1.18 +        super(n);
    1.19 +    }
    1.20 +    
    1.21 +    public void testCompatibility() throws Exception {
    1.22 +        Money m = new Money() {
    1.23 +            public BigDecimal getAmount() {
    1.24 +                return new BigDecimal(1);
    1.25 +            }
    1.26 +
    1.27 +            public Currency getCurrency() {
    1.28 +                return Currency.getInstance("CZK");
    1.29 +            }
    1.30 +        };
    1.31 +        Convertor c = ConvertorFactory.createConvertor(m, m);
    1.32 +    }
    1.33 +}