author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 11 Oct 2008 13:25:34 +0200 | |
changeset 73 | e8b0f13fd4fb |
child 81 | ec70f883de4a |
permissions | -rw-r--r-- |
jtulach@73 | 1 |
package apifest; |
jtulach@73 | 2 |
|
jtulach@73 | 3 |
import java.math.BigDecimal; |
jtulach@73 | 4 |
import java.util.Currency; |
jtulach@73 | 5 |
import junit.framework.TestCase; |
jtulach@73 | 6 |
import org.apidesign.apifest08.currency.Convertor; |
jtulach@73 | 7 |
import org.apidesign.apifest08.currency.ConvertorFactory; |
jtulach@73 | 8 |
import org.apidesign.apifest08.currency.Money; |
jtulach@73 | 9 |
|
jtulach@73 | 10 |
|
jtulach@73 | 11 |
/** Write a test that works with version from task A and fails with version B. |
jtulach@73 | 12 |
*/ |
jtulach@73 | 13 |
public class CurrencyTest extends TestCase { |
jtulach@73 | 14 |
public CurrencyTest(String n) { |
jtulach@73 | 15 |
super(n); |
jtulach@73 | 16 |
} |
jtulach@73 | 17 |
|
jtulach@73 | 18 |
public void testCompatibility() throws Exception { |
jtulach@73 | 19 |
Money m = new Money() { |
jtulach@73 | 20 |
public BigDecimal getAmount() { |
jtulach@73 | 21 |
return new BigDecimal(1); |
jtulach@73 | 22 |
} |
jtulach@73 | 23 |
|
jtulach@73 | 24 |
public Currency getCurrency() { |
jtulach@73 | 25 |
return Currency.getInstance("CZK"); |
jtulach@73 | 26 |
} |
jtulach@73 | 27 |
}; |
jtulach@73 | 28 |
Convertor c = ConvertorFactory.createConvertor(m, m); |
jtulach@73 | 29 |
} |
jtulach@73 | 30 |
} |