task2/solution09/test/org/apidesign/apifest08/test/Task1Test.java
changeset 42 2c8c32ad44f7
parent 41 a7e6f84fb078
child 44 6a500cd1e467
     1.1 --- a/task2/solution09/test/org/apidesign/apifest08/test/Task1Test.java	Tue Oct 07 01:18:23 2008 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,77 +0,0 @@
     1.4 -package org.apidesign.apifest08.test;
     1.5 -
     1.6 -import junit.framework.TestCase;
     1.7 -import org.apidesign.apifest08.currency.Convertor;
     1.8 -import org.apidesign.apifest08.currency.ConvertorFactory;
     1.9 -import org.apidesign.apifest08.currency.CurrencyType;
    1.10 -
    1.11 -/** Finish the Convertor API, and then write bodies of methods inside
    1.12 - * of this class to match the given tasks. To fullfil your task, use the
    1.13 - * API define in the <code>org.apidesign.apifest08.currency</code> package.
    1.14 - * Do not you reflection, or other hacks as your code
    1.15 - * shall run without any runtime permissions.
    1.16 - */
    1.17 -public class Task1Test extends TestCase {
    1.18 -    public Task1Test(String testName) {
    1.19 -        super(testName);
    1.20 -    }
    1.21 -
    1.22 -
    1.23 -    /** Create convertor that understands two currencies, CZK and
    1.24 -     *  USD. Make 1 USD == 17 CZK.
    1.25 -     *
    1.26 -     * Creation of the convertor shall not require subclassing of any class
    1.27 -     * or interface on the client side.
    1.28 -     *
    1.29 -     * @return prepared convertor ready for converting USD to CZK and CZK to USD
    1.30 -     */
    1.31 -    public static Convertor createCZKtoUSD() {
    1.32 -        return ConvertorFactory.getConvertor(CurrencyType.CZK, CurrencyType.USD);
    1.33 -    }
    1.34 -
    1.35 -    /** Create convertor that understands two currencies, CZK and
    1.36 -     *  SKK. Make 100 SKK == 80 CZK.
    1.37 -     *
    1.38 -     * Creation of the convertor shall not require subclassing of any class
    1.39 -     * or interface on the client side.
    1.40 -     * 
    1.41 -     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
    1.42 -     */
    1.43 -    public static Convertor createSKKtoCZK() {
    1.44 -        return ConvertorFactory.getConvertor(CurrencyType.SKK, CurrencyType.CZK);
    1.45 -    }
    1.46 -    
    1.47 -    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
    1.48 -     * with it.
    1.49 -     */
    1.50 -    public void testCurrencyCZKUSD() throws Exception {
    1.51 -        Convertor c = createCZKtoUSD();
    1.52 -
    1.53 -        // convert $5 to CZK using c:
    1.54 -        // assertEquals("Result is 85 CZK");
    1.55 -        assertEquals(85, c.convertTo(5));
    1.56 -
    1.57 -        // convert $8 to CZK
    1.58 -        // assertEquals("Result is 136 CZK");
    1.59 -        assertEquals(136, c.convertTo(8));
    1.60 -
    1.61 -        // convert 1003CZK to USD
    1.62 -        // assertEquals("Result is 59 USD");
    1.63 -        assertEquals(59, c.convertFrom(1003));
    1.64 -    }
    1.65 -
    1.66 -    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
    1.67 -     * with it.
    1.68 -     */
    1.69 -    public void testCurrencySKKCZK() throws Exception {
    1.70 -        Convertor c = createSKKtoCZK();
    1.71 -        // convert 16CZK using c:
    1.72 -        // assertEquals("Result is 20 SKK");
    1.73 -        assertEquals(20, c.convertFrom(16));
    1.74 -
    1.75 -        // convert 500SKK to CZK
    1.76 -        // assertEquals("Result is 400 CZK");
    1.77 -        assertEquals(400, c.convertTo(500));
    1.78 -    }
    1.79 -}
    1.80 -