1.1 --- a/currency/test/org/apidesign/apifest08/test/Task1Test.java Fri Sep 19 23:16:43 2008 +0200
1.2 +++ b/currency/test/org/apidesign/apifest08/test/Task1Test.java Sat Sep 20 18:26:55 2008 +0200
1.3 @@ -1,8 +1,10 @@
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 -/**
1.10 +/** Finish the Convertor API, and then write bodies of methods inside
1.11 + * of this class to match the given tasks.
1.12 */
1.13 public class Task1Test extends TestCase {
1.14 static {
1.15 @@ -20,9 +22,50 @@
1.16 @Override
1.17 protected void tearDown() throws Exception {
1.18 }
1.19 +
1.20 + /** Create convertor that understands two currencies, CZK and
1.21 + * USD. Make 1 USD == 17 CZK.
1.22 + *
1.23 + * @return prepared convertor ready for converting USD to CZK and CZK to USD
1.24 + */
1.25 + public static Convertor createCZKtoUSD() {
1.26 + return null;
1.27 + }
1.28 +
1.29 + /** Create convertor that understands two currencies, CZK and
1.30 + * SKK. Make 100 SKK == 80 CZK.
1.31 + *
1.32 + * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
1.33 + */
1.34 + public static Convertor createSKKtoCZK() {
1.35 + return null;
1.36 + }
1.37
1.38 -
1.39 + /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
1.40 + * with it.
1.41 + */
1.42 public void testCurrencyCZKUSD() throws Exception {
1.43 -
1.44 + Convertor c = createCZKtoUSD();
1.45 + // convert $5 to CZK using c:
1.46 + // assertEquals("Result is 85 CZK");
1.47 +
1.48 + // convert $8 to CZK
1.49 + // assertEquals("Result is 136 CZK");
1.50 +
1.51 + // convert 1003CZK to USD
1.52 + // assertEquals("Result is 59 USD");
1.53 + }
1.54 +
1.55 + /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
1.56 + * with it.
1.57 + */
1.58 + public void testCurrencySKKCZK() throws Exception {
1.59 + Convertor c = createSKKtoCZK();
1.60 + // convert 16CZK using c:
1.61 + // assertEquals("Result is 20 SKK");
1.62 +
1.63 + // convert 500SKK to CZK
1.64 + // assertEquals("Result is 400 CZK");
1.65 }
1.66 }
1.67 +