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