Jan Zak managed to break solutions 4, 6, 13, 14
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 25 Oct 2008 20:30:54 +0200
changeset 83621462e58e22
parent 82 f2a4b0e116c2
child 84 2ae6e4aa7aef
Jan Zak managed to break solutions 4, 6, 13, 14
taskx/ked/against-solution04/build.xml
taskx/ked/against-solution04/nbproject/project.xml
taskx/ked/against-solution04/project.properties
taskx/ked/against-solution04/test/apifest/CurrencyTest.java
taskx/ked/against-solution06/build.xml
taskx/ked/against-solution06/nbproject/project.xml
taskx/ked/against-solution06/project.properties
taskx/ked/against-solution06/test/apifest/CurrencyTest.java
taskx/ked/against-solution13/build.xml
taskx/ked/against-solution13/nbproject/project.xml
taskx/ked/against-solution13/project.properties
taskx/ked/against-solution13/test/apifest/CurrencyTest.java
taskx/ked/against-solution14/build.xml
taskx/ked/against-solution14/nbproject/project.xml
taskx/ked/against-solution14/project.properties
taskx/ked/against-solution14/test/apifest/CurrencyTest.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/taskx/ked/against-solution04/build.xml	Sat Oct 25 20:30:54 2008 +0200
     1.3 @@ -0,0 +1,5 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!-- this is a template file to test  -->
     1.6 +<project name="testing-template" default="run" basedir=".">
     1.7 +    <import file="../../common.xml"/>
     1.8 +</project>    
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/taskx/ked/against-solution04/nbproject/project.xml	Sat Oct 25 20:30:54 2008 +0200
     2.3 @@ -0,0 +1,82 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     2.6 +    <type>org.netbeans.modules.ant.freeform</type>
     2.7 +    <configuration>
     2.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
     2.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
    2.10 +            <name>testing template</name>
    2.11 +            <properties>
    2.12 +                <property name="ant.script">build.xml</property>
    2.13 +                <property name="apifest">../../../</property>
    2.14 +                <property-file>project.properties</property-file>
    2.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
    2.16 +            </properties>
    2.17 +            <folders>
    2.18 +                <source-folder>
    2.19 +                    <label>test</label>
    2.20 +                    <type>java</type>
    2.21 +                    <location>test</location>
    2.22 +                </source-folder>
    2.23 +            </folders>
    2.24 +            <ide-actions>
    2.25 +                <action name="build">
    2.26 +                    <script>${ant.script}</script>
    2.27 +                    <target>compile</target>
    2.28 +                </action>
    2.29 +                <action name="clean">
    2.30 +                    <script>${ant.script}</script>
    2.31 +                    <target>clean</target>
    2.32 +                </action>
    2.33 +                <action name="run">
    2.34 +                    <script>${ant.script}</script>
    2.35 +                    <target>test</target>
    2.36 +                </action>
    2.37 +                <action name="test">
    2.38 +                    <script>${ant.script}</script>
    2.39 +                    <target>test</target>
    2.40 +                </action>
    2.41 +                <action name="rebuild">
    2.42 +                    <script>${ant.script}</script>
    2.43 +                    <target>clean</target>
    2.44 +                    <target>compile</target>
    2.45 +                </action>
    2.46 +            </ide-actions>
    2.47 +            <export>
    2.48 +                <type>folder</type>
    2.49 +                <location>build/tests</location>
    2.50 +                <script>${ant.script}</script>
    2.51 +                <build-target>compile</build-target>
    2.52 +            </export>
    2.53 +            <view>
    2.54 +                <items>
    2.55 +                    <source-folder style="packages">
    2.56 +                        <label>test</label>
    2.57 +                        <location>test</location>
    2.58 +                    </source-folder>
    2.59 +                    <source-file>
    2.60 +                        <location>${ant.script}</location>
    2.61 +                    </source-file>
    2.62 +                    <source-file>
    2.63 +                        <location>project.properties</location>
    2.64 +                    </source-file>
    2.65 +                </items>
    2.66 +                <context-menu>
    2.67 +                    <ide-action name="build"/>
    2.68 +                    <ide-action name="clean"/>
    2.69 +                    <ide-action name="run"/>
    2.70 +                    <ide-action name="test"/>
    2.71 +                    <ide-action name="rebuild"/>
    2.72 +                </context-menu>
    2.73 +            </view>
    2.74 +            <subprojects/>
    2.75 +        </general-data>
    2.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
    2.77 +            <compilation-unit>
    2.78 +                <package-root>test</package-root>
    2.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
    2.80 +                <built-to>build/tests</built-to>
    2.81 +                <source-level>1.5</source-level>
    2.82 +            </compilation-unit>
    2.83 +        </java-data>
    2.84 +    </configuration>
    2.85 +</project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/taskx/ked/against-solution04/project.properties	Sat Oct 25 20:30:54 2008 +0200
     3.3 @@ -0,0 +1,16 @@
     3.4 +
     3.5 +# name of a project to test
     3.6 +apitotest=solution04
     3.7 +#for example use:
     3.8 +#apitotest=solution01
     3.9 +
    3.10 +# the test shall expose a problem between two versions
    3.11 +# of one API. select the first version - taskA and a second
    3.12 +# version of the of the API taskB
    3.13 +taskA=${apifest}/task1
    3.14 +taskB=${apifest}/task2
    3.15 +
    3.16 +# usual locations of API classes for each version
    3.17 +apiA=${taskA}/${apitotest}/build/classes/
    3.18 +apiB=${taskB}/${apitotest}/build/classes/
    3.19 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/taskx/ked/against-solution04/test/apifest/CurrencyTest.java	Sat Oct 25 20:30:54 2008 +0200
     4.3 @@ -0,0 +1,33 @@
     4.4 +package apifest;
     4.5 +
     4.6 +import java.math.BigDecimal;
     4.7 +import java.util.Currency;
     4.8 +import junit.framework.TestCase;
     4.9 +import org.apidesign.apifest08.currency.Convertor;
    4.10 +import org.apidesign.apifest08.currency.InvalidConversionException;
    4.11 +
    4.12 +
    4.13 +/** Write a test that works with version from task A and fails with version B.
    4.14 + */
    4.15 +public class CurrencyTest extends TestCase {
    4.16 +    public CurrencyTest(String n) {
    4.17 +        super(n);
    4.18 +    }
    4.19 +    
    4.20 +    public void testCompatibility() throws Exception {
    4.21 +        Convertor myOwnImplementationOfConvertor =
    4.22 +                new MyOwnImplementationOfConvertor();
    4.23 +        
    4.24 +        BigDecimal result = myOwnImplementationOfConvertor.convert(
    4.25 +                Currency.getInstance("CZK"),
    4.26 +                Currency.getInstance("USD"),
    4.27 +                new BigDecimal("1"));
    4.28 +        assertEquals(1, result.intValue());
    4.29 +    }
    4.30 +    
    4.31 +    class MyOwnImplementationOfConvertor implements Convertor {
    4.32 +        public BigDecimal convert(Currency from, Currency to, BigDecimal amount) throws InvalidConversionException {
    4.33 +            return amount; // not very smart implementation
    4.34 +        }
    4.35 +    }
    4.36 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/taskx/ked/against-solution06/build.xml	Sat Oct 25 20:30:54 2008 +0200
     5.3 @@ -0,0 +1,5 @@
     5.4 +<?xml version="1.0" encoding="UTF-8"?>
     5.5 +<!-- this is a template file to test  -->
     5.6 +<project name="testing-template" default="run" basedir=".">
     5.7 +    <import file="../../common.xml"/>
     5.8 +</project>    
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/taskx/ked/against-solution06/nbproject/project.xml	Sat Oct 25 20:30:54 2008 +0200
     6.3 @@ -0,0 +1,82 @@
     6.4 +<?xml version="1.0" encoding="UTF-8"?>
     6.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     6.6 +    <type>org.netbeans.modules.ant.freeform</type>
     6.7 +    <configuration>
     6.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
     6.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
    6.10 +            <name>testing template</name>
    6.11 +            <properties>
    6.12 +                <property name="ant.script">build.xml</property>
    6.13 +                <property name="apifest">../../../</property>
    6.14 +                <property-file>project.properties</property-file>
    6.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
    6.16 +            </properties>
    6.17 +            <folders>
    6.18 +                <source-folder>
    6.19 +                    <label>test</label>
    6.20 +                    <type>java</type>
    6.21 +                    <location>test</location>
    6.22 +                </source-folder>
    6.23 +            </folders>
    6.24 +            <ide-actions>
    6.25 +                <action name="build">
    6.26 +                    <script>${ant.script}</script>
    6.27 +                    <target>compile</target>
    6.28 +                </action>
    6.29 +                <action name="clean">
    6.30 +                    <script>${ant.script}</script>
    6.31 +                    <target>clean</target>
    6.32 +                </action>
    6.33 +                <action name="run">
    6.34 +                    <script>${ant.script}</script>
    6.35 +                    <target>test</target>
    6.36 +                </action>
    6.37 +                <action name="test">
    6.38 +                    <script>${ant.script}</script>
    6.39 +                    <target>test</target>
    6.40 +                </action>
    6.41 +                <action name="rebuild">
    6.42 +                    <script>${ant.script}</script>
    6.43 +                    <target>clean</target>
    6.44 +                    <target>compile</target>
    6.45 +                </action>
    6.46 +            </ide-actions>
    6.47 +            <export>
    6.48 +                <type>folder</type>
    6.49 +                <location>build/tests</location>
    6.50 +                <script>${ant.script}</script>
    6.51 +                <build-target>compile</build-target>
    6.52 +            </export>
    6.53 +            <view>
    6.54 +                <items>
    6.55 +                    <source-folder style="packages">
    6.56 +                        <label>test</label>
    6.57 +                        <location>test</location>
    6.58 +                    </source-folder>
    6.59 +                    <source-file>
    6.60 +                        <location>${ant.script}</location>
    6.61 +                    </source-file>
    6.62 +                    <source-file>
    6.63 +                        <location>project.properties</location>
    6.64 +                    </source-file>
    6.65 +                </items>
    6.66 +                <context-menu>
    6.67 +                    <ide-action name="build"/>
    6.68 +                    <ide-action name="clean"/>
    6.69 +                    <ide-action name="run"/>
    6.70 +                    <ide-action name="test"/>
    6.71 +                    <ide-action name="rebuild"/>
    6.72 +                </context-menu>
    6.73 +            </view>
    6.74 +            <subprojects/>
    6.75 +        </general-data>
    6.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
    6.77 +            <compilation-unit>
    6.78 +                <package-root>test</package-root>
    6.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
    6.80 +                <built-to>build/tests</built-to>
    6.81 +                <source-level>1.5</source-level>
    6.82 +            </compilation-unit>
    6.83 +        </java-data>
    6.84 +    </configuration>
    6.85 +</project>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/taskx/ked/against-solution06/project.properties	Sat Oct 25 20:30:54 2008 +0200
     7.3 @@ -0,0 +1,16 @@
     7.4 +
     7.5 +# name of a project to test
     7.6 +apitotest=solution06
     7.7 +#for example use:
     7.8 +#apitotest=solution01
     7.9 +
    7.10 +# the test shall expose a problem between two versions
    7.11 +# of one API. select the first version - taskA and a second
    7.12 +# version of the of the API taskB
    7.13 +taskA=${apifest}/task1
    7.14 +taskB=${apifest}/task2
    7.15 +
    7.16 +# usual locations of API classes for each version
    7.17 +apiA=${taskA}/${apitotest}/build/classes/
    7.18 +apiB=${taskB}/${apitotest}/build/classes/
    7.19 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/taskx/ked/against-solution06/test/apifest/CurrencyTest.java	Sat Oct 25 20:30:54 2008 +0200
     8.3 @@ -0,0 +1,19 @@
     8.4 +package apifest;
     8.5 +
     8.6 +import java.math.BigDecimal;
     8.7 +import junit.framework.TestCase;
     8.8 +import org.apidesign.apifest08.currency.Convertor;
     8.9 +
    8.10 +
    8.11 +/** Write a test that works with version from task A and fails with version B.
    8.12 + */
    8.13 +public class CurrencyTest extends TestCase {
    8.14 +    public CurrencyTest(String n) {
    8.15 +        super(n);
    8.16 +    }
    8.17 +    
    8.18 +    public void testCompatibility() throws Exception {
    8.19 +        BigDecimal iWantToUseThisAPIConstant = Convertor.one;
    8.20 +        assertEquals(1, iWantToUseThisAPIConstant.intValue());
    8.21 +    }
    8.22 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/taskx/ked/against-solution13/build.xml	Sat Oct 25 20:30:54 2008 +0200
     9.3 @@ -0,0 +1,5 @@
     9.4 +<?xml version="1.0" encoding="UTF-8"?>
     9.5 +<!-- this is a template file to test  -->
     9.6 +<project name="testing-template" default="run" basedir=".">
     9.7 +    <import file="../../common.xml"/>
     9.8 +</project>    
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/taskx/ked/against-solution13/nbproject/project.xml	Sat Oct 25 20:30:54 2008 +0200
    10.3 @@ -0,0 +1,82 @@
    10.4 +<?xml version="1.0" encoding="UTF-8"?>
    10.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    10.6 +    <type>org.netbeans.modules.ant.freeform</type>
    10.7 +    <configuration>
    10.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
    10.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
   10.10 +            <name>testing template</name>
   10.11 +            <properties>
   10.12 +                <property name="ant.script">build.xml</property>
   10.13 +                <property name="apifest">../../../</property>
   10.14 +                <property-file>project.properties</property-file>
   10.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
   10.16 +            </properties>
   10.17 +            <folders>
   10.18 +                <source-folder>
   10.19 +                    <label>test</label>
   10.20 +                    <type>java</type>
   10.21 +                    <location>test</location>
   10.22 +                </source-folder>
   10.23 +            </folders>
   10.24 +            <ide-actions>
   10.25 +                <action name="build">
   10.26 +                    <script>${ant.script}</script>
   10.27 +                    <target>compile</target>
   10.28 +                </action>
   10.29 +                <action name="clean">
   10.30 +                    <script>${ant.script}</script>
   10.31 +                    <target>clean</target>
   10.32 +                </action>
   10.33 +                <action name="run">
   10.34 +                    <script>${ant.script}</script>
   10.35 +                    <target>test</target>
   10.36 +                </action>
   10.37 +                <action name="test">
   10.38 +                    <script>${ant.script}</script>
   10.39 +                    <target>test</target>
   10.40 +                </action>
   10.41 +                <action name="rebuild">
   10.42 +                    <script>${ant.script}</script>
   10.43 +                    <target>clean</target>
   10.44 +                    <target>compile</target>
   10.45 +                </action>
   10.46 +            </ide-actions>
   10.47 +            <export>
   10.48 +                <type>folder</type>
   10.49 +                <location>build/tests</location>
   10.50 +                <script>${ant.script}</script>
   10.51 +                <build-target>compile</build-target>
   10.52 +            </export>
   10.53 +            <view>
   10.54 +                <items>
   10.55 +                    <source-folder style="packages">
   10.56 +                        <label>test</label>
   10.57 +                        <location>test</location>
   10.58 +                    </source-folder>
   10.59 +                    <source-file>
   10.60 +                        <location>${ant.script}</location>
   10.61 +                    </source-file>
   10.62 +                    <source-file>
   10.63 +                        <location>project.properties</location>
   10.64 +                    </source-file>
   10.65 +                </items>
   10.66 +                <context-menu>
   10.67 +                    <ide-action name="build"/>
   10.68 +                    <ide-action name="clean"/>
   10.69 +                    <ide-action name="run"/>
   10.70 +                    <ide-action name="test"/>
   10.71 +                    <ide-action name="rebuild"/>
   10.72 +                </context-menu>
   10.73 +            </view>
   10.74 +            <subprojects/>
   10.75 +        </general-data>
   10.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
   10.77 +            <compilation-unit>
   10.78 +                <package-root>test</package-root>
   10.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
   10.80 +                <built-to>build/tests</built-to>
   10.81 +                <source-level>1.5</source-level>
   10.82 +            </compilation-unit>
   10.83 +        </java-data>
   10.84 +    </configuration>
   10.85 +</project>
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/taskx/ked/against-solution13/project.properties	Sat Oct 25 20:30:54 2008 +0200
    11.3 @@ -0,0 +1,16 @@
    11.4 +
    11.5 +# name of a project to test
    11.6 +apitotest=solution13
    11.7 +#for example use:
    11.8 +#apitotest=solution01
    11.9 +
   11.10 +# the test shall expose a problem between two versions
   11.11 +# of one API. select the first version - taskA and a second
   11.12 +# version of the of the API taskB
   11.13 +taskA=${apifest}/task1
   11.14 +taskB=${apifest}/task2
   11.15 +
   11.16 +# usual locations of API classes for each version
   11.17 +apiA=${taskA}/${apitotest}/build/classes/
   11.18 +apiB=${taskB}/${apitotest}/build/classes/
   11.19 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/taskx/ked/against-solution13/test/apifest/CurrencyTest.java	Sat Oct 25 20:30:54 2008 +0200
    12.3 @@ -0,0 +1,49 @@
    12.4 +package apifest;
    12.5 +
    12.6 +import java.math.BigDecimal;
    12.7 +import junit.framework.TestCase;
    12.8 +import org.apidesign.apifest08.currency.Convertor;
    12.9 +import org.apidesign.apifest08.currency.ConvertorCurrency;
   12.10 +import org.apidesign.apifest08.currency.ExchangeRateProvider;
   12.11 +
   12.12 +
   12.13 +/** Write a test that works with version from task A and fails with version B.
   12.14 + */
   12.15 +public class CurrencyTest extends TestCase {
   12.16 +    public CurrencyTest(String n) {
   12.17 +        super(n);
   12.18 +    }
   12.19 +    
   12.20 +    /** Fails because runtime incompatibility. */
   12.21 +    public void testCompatibility() throws Exception {
   12.22 +        ConvertorCurrency cur1 = ConvertorCurrency.getInstance("CZK");
   12.23 +        ConvertorCurrency cur2 = ConvertorCurrency.getInstance("CZK");
   12.24 +        
   12.25 +        assertEquals(false, cur1.equals(cur2));
   12.26 +    }
   12.27 +
   12.28 +    /** Fails because source incompatibility. */
   12.29 +    public void testCompatibility2() throws Exception {
   12.30 +        MyOwnExchangeRateProvider provider = new MyOwnExchangeRateProvider(
   12.31 +                new BigDecimal("1"), ConvertorCurrency.getInstance("USD"),
   12.32 +                new BigDecimal("16"), ConvertorCurrency.getInstance("CZK"));
   12.33 +        Convertor c = Convertor.createConvertor(provider);
   12.34 +        
   12.35 +        boolean result = provider.addFixedCurencyRate(
   12.36 +                ConvertorCurrency.getInstance("CZK"), new BigDecimal("80"),
   12.37 +                ConvertorCurrency.getInstance("SKK"), new BigDecimal("100"));
   12.38 +        assertEquals(true, result);
   12.39 +    }
   12.40 +    
   12.41 +    class MyOwnExchangeRateProvider extends ExchangeRateProvider {
   12.42 +
   12.43 +        public MyOwnExchangeRateProvider(BigDecimal fromValue, ConvertorCurrency fromCurrency, BigDecimal toValue, ConvertorCurrency toCurrency) {
   12.44 +            super(fromValue, fromCurrency, toValue, toCurrency);
   12.45 +        }
   12.46 +    
   12.47 +        public boolean addFixedCurencyRate(ConvertorCurrency fromCurrency, BigDecimal fromValue, ConvertorCurrency toCurrency, BigDecimal toValue) {
   12.48 +            return true; // great method - do nothing and is always satisfied ;-)
   12.49 +        }
   12.50 +
   12.51 +    }
   12.52 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/taskx/ked/against-solution14/build.xml	Sat Oct 25 20:30:54 2008 +0200
    13.3 @@ -0,0 +1,5 @@
    13.4 +<?xml version="1.0" encoding="UTF-8"?>
    13.5 +<!-- this is a template file to test  -->
    13.6 +<project name="testing-template" default="run" basedir=".">
    13.7 +    <import file="../../common.xml"/>
    13.8 +</project>    
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/taskx/ked/against-solution14/nbproject/project.xml	Sat Oct 25 20:30:54 2008 +0200
    14.3 @@ -0,0 +1,82 @@
    14.4 +<?xml version="1.0" encoding="UTF-8"?>
    14.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    14.6 +    <type>org.netbeans.modules.ant.freeform</type>
    14.7 +    <configuration>
    14.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
    14.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
   14.10 +            <name>testing template</name>
   14.11 +            <properties>
   14.12 +                <property name="ant.script">build.xml</property>
   14.13 +                <property name="apifest">../../../</property>
   14.14 +                <property-file>project.properties</property-file>
   14.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
   14.16 +            </properties>
   14.17 +            <folders>
   14.18 +                <source-folder>
   14.19 +                    <label>test</label>
   14.20 +                    <type>java</type>
   14.21 +                    <location>test</location>
   14.22 +                </source-folder>
   14.23 +            </folders>
   14.24 +            <ide-actions>
   14.25 +                <action name="build">
   14.26 +                    <script>${ant.script}</script>
   14.27 +                    <target>compile</target>
   14.28 +                </action>
   14.29 +                <action name="clean">
   14.30 +                    <script>${ant.script}</script>
   14.31 +                    <target>clean</target>
   14.32 +                </action>
   14.33 +                <action name="run">
   14.34 +                    <script>${ant.script}</script>
   14.35 +                    <target>test</target>
   14.36 +                </action>
   14.37 +                <action name="test">
   14.38 +                    <script>${ant.script}</script>
   14.39 +                    <target>test</target>
   14.40 +                </action>
   14.41 +                <action name="rebuild">
   14.42 +                    <script>${ant.script}</script>
   14.43 +                    <target>clean</target>
   14.44 +                    <target>compile</target>
   14.45 +                </action>
   14.46 +            </ide-actions>
   14.47 +            <export>
   14.48 +                <type>folder</type>
   14.49 +                <location>build/tests</location>
   14.50 +                <script>${ant.script}</script>
   14.51 +                <build-target>compile</build-target>
   14.52 +            </export>
   14.53 +            <view>
   14.54 +                <items>
   14.55 +                    <source-folder style="packages">
   14.56 +                        <label>test</label>
   14.57 +                        <location>test</location>
   14.58 +                    </source-folder>
   14.59 +                    <source-file>
   14.60 +                        <location>${ant.script}</location>
   14.61 +                    </source-file>
   14.62 +                    <source-file>
   14.63 +                        <location>project.properties</location>
   14.64 +                    </source-file>
   14.65 +                </items>
   14.66 +                <context-menu>
   14.67 +                    <ide-action name="build"/>
   14.68 +                    <ide-action name="clean"/>
   14.69 +                    <ide-action name="run"/>
   14.70 +                    <ide-action name="test"/>
   14.71 +                    <ide-action name="rebuild"/>
   14.72 +                </context-menu>
   14.73 +            </view>
   14.74 +            <subprojects/>
   14.75 +        </general-data>
   14.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
   14.77 +            <compilation-unit>
   14.78 +                <package-root>test</package-root>
   14.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
   14.80 +                <built-to>build/tests</built-to>
   14.81 +                <source-level>1.5</source-level>
   14.82 +            </compilation-unit>
   14.83 +        </java-data>
   14.84 +    </configuration>
   14.85 +</project>
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/taskx/ked/against-solution14/project.properties	Sat Oct 25 20:30:54 2008 +0200
    15.3 @@ -0,0 +1,16 @@
    15.4 +
    15.5 +# name of a project to test
    15.6 +apitotest=solution14
    15.7 +#for example use:
    15.8 +#apitotest=solution01
    15.9 +
   15.10 +# the test shall expose a problem between two versions
   15.11 +# of one API. select the first version - taskA and a second
   15.12 +# version of the of the API taskB
   15.13 +taskA=${apifest}/task3
   15.14 +taskB=${apifest}/task4
   15.15 +
   15.16 +# usual locations of API classes for each version
   15.17 +apiA=${taskA}/${apitotest}/build/classes/
   15.18 +apiB=${taskB}/${apitotest}/build/classes/
   15.19 +
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/taskx/ked/against-solution14/test/apifest/CurrencyTest.java	Sat Oct 25 20:30:54 2008 +0200
    16.3 @@ -0,0 +1,56 @@
    16.4 +package apifest;
    16.5 +
    16.6 +import junit.framework.TestCase;
    16.7 +import org.apidesign.apifest08.currency.Convertor;
    16.8 +import org.apidesign.apifest08.currency.ConvertorFactory;
    16.9 +import org.apidesign.apifest08.currency.CurrencyRate;
   16.10 +import org.apidesign.apifest08.currency.Rate;
   16.11 +
   16.12 +
   16.13 +/** Write a test that works with version from task A and fails with version B.
   16.14 + */
   16.15 +public class CurrencyTest extends TestCase {
   16.16 +    public CurrencyTest(String n) {
   16.17 +        super(n);
   16.18 +    }
   16.19 +    
   16.20 +    public void testCompatibility() throws Exception {
   16.21 +        
   16.22 +        Convertor c = ConvertorFactory.newInstance().createConvertor(
   16.23 +                new MyOwnCurrencyRate("CZK", "USD", new Rate(1, 16), "ABCDEF"));
   16.24 +        
   16.25 +        MyOwnCurrencyRate[] arr = c.getCurrencyRates().toArray(new MyOwnCurrencyRate[1]);
   16.26 +        assertEquals("ABCDEF", arr[0].getMyImportantProperty());
   16.27 +    }
   16.28 +    
   16.29 +    class MyOwnCurrencyRate implements CurrencyRate {
   16.30 +
   16.31 +        private final String currency1;
   16.32 +        private final String currency2;
   16.33 +        private final Rate rate;
   16.34 +        private final String myImportantProperty;
   16.35 +        
   16.36 +        public MyOwnCurrencyRate(String currency1, String currency2, Rate rate, String myImportantProperty) {
   16.37 +            this.currency1 = currency1;
   16.38 +            this.currency2 = currency2;
   16.39 +            this.rate = rate;
   16.40 +            this.myImportantProperty = myImportantProperty;
   16.41 +        }
   16.42 +        
   16.43 +        public String getCurrency1() {
   16.44 +            return currency1;
   16.45 +        }
   16.46 +
   16.47 +        public String getCurrency2() {
   16.48 +            return currency2;
   16.49 +        }
   16.50 +
   16.51 +        public Rate getRate() {
   16.52 +            return rate;
   16.53 +        }
   16.54 +
   16.55 +        public String getMyImportantProperty() {
   16.56 +            return myImportantProperty;
   16.57 +        }
   16.58 +    }
   16.59 +}