taskx/psmid/against-solution11/test/apifest/CurrencyTest.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 25 Oct 2008 20:53:00 +0200
changeset 84 2ae6e4aa7aef
permissions -rw-r--r--
Solutions by Petr Smid
     1 package apifest;
     2 
     3 import junit.framework.TestCase;
     4 import org.apidesign.apifest08.currency.Convertor;
     5 import org.apidesign.apifest08.currency.CurrencyValue;
     6 //import static org.apidesign.apifest08.test.Currencies.CZK;
     7 //import static org.apidesign.apifest08.test.Currencies.SKK;
     8 //import static org.apidesign.apifest08.test.Currencies.USD;
     9 
    10 /** Write a test that works with version from task A and fails with version B.
    11  */
    12 public class CurrencyTest extends TestCase {
    13     public CurrencyTest(String n) {
    14         super(n);
    15     }
    16 
    17     public void testCompatibility() throws Exception {
    18         try {
    19             Convertor c = Convertor.getConvertorIntegerString(
    20                 CurrencyValue.getCurrencyValue(1, "CZK"),
    21                 CurrencyValue.getCurrencyValue(1, "CZK")
    22             );
    23             c.convert("CZK", CurrencyValue.getCurrencyValue(10, "CZK"));
    24             fail("Should throw exception");
    25         } catch (IllegalArgumentException e) {
    26             //ok
    27         }
    28     }
    29 }