task4/solution02/test/org/apidesign/apifest08/currency/CompositeConvertorTest.java
changeset 70 6f4b6952f988
parent 69 420baec87dc5
child 71 978f6a78c22e
     1.1 --- a/task4/solution02/test/org/apidesign/apifest08/currency/CompositeConvertorTest.java	Fri Oct 17 17:40:14 2008 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,56 +0,0 @@
     1.4 -package org.apidesign.apifest08.currency;
     1.5 -
     1.6 -import static junit.framework.Assert.assertEquals;
     1.7 -import static junit.framework.Assert.assertFalse;
     1.8 -import static junit.framework.Assert.assertTrue;
     1.9 -import static junit.framework.Assert.fail;
    1.10 -import static org.apidesign.apifest08.test.Task1Test.CZK;
    1.11 -import static org.apidesign.apifest08.test.Task1Test.SKK;
    1.12 -import static org.apidesign.apifest08.test.Task1Test.USD;
    1.13 -
    1.14 -import org.junit.Test;
    1.15 -
    1.16 -public class CompositeConvertorTest {
    1.17 -	private static final ExtendedConvertor USD_CZK_CONVERTOR = ConvertorFactory.createConvertor(new MoneyImpl(1,USD), new MoneyImpl(17,CZK));
    1.18 -	private static final ExtendedConvertor SKK_CZK_CONVERTOR = ConvertorFactory.createConvertor(new MoneyImpl(100,SKK), new MoneyImpl(80,CZK));
    1.19 -
    1.20 -	@Test
    1.21 -	public void testCompose()
    1.22 -	{
    1.23 -		ExtendedConvertor convertor = new CompositeConvertor(USD_CZK_CONVERTOR, SKK_CZK_CONVERTOR);
    1.24 -		assertTrue(convertor.isConversionSupported(CZK, SKK));
    1.25 -		assertTrue(convertor.isConversionSupported(CZK, USD));
    1.26 -		assertFalse(convertor.isConversionSupported(SKK, USD));
    1.27 -		assertEquals(new MoneyImpl(10,SKK), convertor.convert(new MoneyImpl(8,CZK), SKK));
    1.28 -		assertEquals(new MoneyImpl(2,USD), convertor.convert(new MoneyImpl(34,CZK), USD));
    1.29 -		try
    1.30 -		{
    1.31 -			convertor.convert(new MoneyImpl(34,SKK), USD);
    1.32 -			fail("Exception expected");
    1.33 -		}
    1.34 -		catch(IllegalArgumentException e)
    1.35 -		{
    1.36 -			assertTrue("Ok", true);
    1.37 -		}
    1.38 -	}
    1.39 -	@Test
    1.40 -	public void testEmpty()
    1.41 -	{
    1.42 -		ExtendedConvertor convertor = new CompositeConvertor();
    1.43 -		assertFalse(convertor.isConversionSupported(SKK, USD));
    1.44 -		try
    1.45 -		{
    1.46 -			convertor.convert(new MoneyImpl(34,SKK), USD);
    1.47 -			fail("Exception expected");
    1.48 -		}
    1.49 -		catch(IllegalArgumentException e)
    1.50 -		{
    1.51 -			assertTrue("Ok", true);
    1.52 -		}
    1.53 -	}
    1.54 -	@Test(expected=NullPointerException.class)
    1.55 -	public void testCreateNull()
    1.56 -	{
    1.57 -		new CompositeConvertor(USD_CZK_CONVERTOR, null);
    1.58 -	}
    1.59 -}