taskx/jtulach/against-solution06/test/apifest/CurrencyTest.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 11 Oct 2008 18:25:11 +0200
changeset 79 0c910349ba67
parent 14 taskx/jtulach/against-solutionXY/test/apifest/CurrencyTest.java@d907b216f8a1
permissions -rw-r--r--
Solution 06 is quite good (maybe perfect) from the perspective of binary compatibility. For a while I thought I am going to give up, however then I noticed that there is an added overloaded method. With proper parameters this can cause the previously OK source to become uncompilable.
jaroslav@14
     1
package apifest;
jaroslav@14
     2
jtulach@79
     3
import java.util.Currency;
jaroslav@14
     4
import junit.framework.TestCase;
jaroslav@14
     5
import org.apidesign.apifest08.currency.Convertor;
jaroslav@14
     6
jaroslav@14
     7
jaroslav@14
     8
/** Write a test that works with version from task A and fails with version B.
jaroslav@14
     9
 */
jaroslav@14
    10
public class CurrencyTest extends TestCase {
jaroslav@14
    11
    public CurrencyTest(String n) {
jaroslav@14
    12
        super(n);
jaroslav@14
    13
    }
jaroslav@14
    14
    
jaroslav@14
    15
    public void testCompatibility() throws Exception {
jtulach@79
    16
        Currency cur1 = Currency.getInstance("CZK");
jtulach@79
    17
        Currency cur2 = Currency.getInstance("SKK");
jtulach@79
    18
        Convertor c = new Convertor(null, cur1, cur2);
jaroslav@14
    19
    }
jaroslav@14
    20
}