currency/test/org/apidesign/apifest08/test/Task1Test.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 20 Sep 2008 18:26:55 +0200
changeset 1 676b4c07fa0a
parent 0 e0003d2fb0c2
child 3 81bafaac7336
permissions -rw-r--r--
Removing references to 'bool'
Adding first tasks to Task1Test
     1 package org.apidesign.apifest08.test;
     2 
     3 import junit.framework.TestCase;
     4 import org.apidesign.apifest08.currency.Convertor;
     5 
     6 /** Finish the Convertor API, and then write bodies of methods inside
     7  * of this class to match the given tasks.
     8  */
     9 public class Task1Test extends TestCase {
    10     static {
    11         // your code shall run without any permissions
    12     }
    13     
    14     public Task1Test(String testName) {
    15         super(testName);
    16     }
    17 
    18     @Override
    19     protected void setUp() throws Exception {
    20     }
    21 
    22     @Override
    23     protected void tearDown() throws Exception {
    24     }
    25 
    26     /** Create convertor that understands two currencies, CZK and
    27      *  USD. Make 1 USD == 17 CZK.
    28      *
    29      * @return prepared convertor ready for converting USD to CZK and CZK to USD
    30      */
    31     public static Convertor createCZKtoUSD() {
    32         return null;
    33     }
    34 
    35     /** Create convertor that understands two currencies, CZK and
    36      *  SKK. Make 100 SKK == 80 CZK.
    37      *
    38      * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
    39      */
    40     public static Convertor createSKKtoCZK() {
    41         return null;
    42     }
    43     
    44     /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
    45      * with it.
    46      */
    47     public void testCurrencyCZKUSD() throws Exception {
    48         Convertor c = createCZKtoUSD();
    49         // convert $5 to CZK using c:
    50         // assertEquals("Result is 85 CZK");
    51 
    52         // convert $8 to CZK
    53         // assertEquals("Result is 136 CZK");
    54 
    55         // convert 1003CZK to USD
    56         // assertEquals("Result is 59 USD");
    57     }
    58 
    59     /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
    60      * with it.
    61      */
    62     public void testCurrencySKKCZK() throws Exception {
    63         Convertor c = createSKKtoCZK();
    64         // convert 16CZK using c:
    65         // assertEquals("Result is 20 SKK");
    66 
    67         // convert 500SKK to CZK
    68         // assertEquals("Result is 400 CZK");
    69     }
    70 }
    71