Solutions by Petr Smid default tip
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 25 Oct 2008 20:53:00 +0200
changeset 842ae6e4aa7aef
parent 83 621462e58e22
Solutions by Petr Smid
.hgignore
taskx/psmid/against-solution04/build.xml
taskx/psmid/against-solution04/nbproject/project.xml
taskx/psmid/against-solution04/project.properties
taskx/psmid/against-solution04/test/apifest/CurrencyTest.java
taskx/psmid/against-solution06/build.xml
taskx/psmid/against-solution06/nbproject/project.xml
taskx/psmid/against-solution06/project.properties
taskx/psmid/against-solution06/test/apifest/CurrencyTest.java
taskx/psmid/against-solution11/build.xml
taskx/psmid/against-solution11/nbproject/project.xml
taskx/psmid/against-solution11/project.properties
taskx/psmid/against-solution11/test/apifest/CurrencyTest.java
taskx/psmid/against-solution13/build.xml
taskx/psmid/against-solution13/nbproject/project.xml
taskx/psmid/against-solution13/project.properties
taskx/psmid/against-solution13/test/apifest/CurrencyTest.java
     1.1 --- a/.hgignore	Sat Oct 25 20:30:54 2008 +0200
     1.2 +++ b/.hgignore	Sat Oct 25 20:53:00 2008 +0200
     1.3 @@ -2,4 +2,5 @@
     1.4  .*/dist/.*
     1.5  .*/build/.*
     1.6  .*orig
     1.7 +.*~
     1.8  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/taskx/psmid/against-solution04/build.xml	Sat Oct 25 20:53:00 2008 +0200
     2.3 @@ -0,0 +1,5 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<!-- this is a template file to test  -->
     2.6 +<project name="testing-template" default="run" basedir=".">
     2.7 +    <import file="../../common.xml"/>
     2.8 +</project>    
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/taskx/psmid/against-solution04/nbproject/project.xml	Sat Oct 25 20:53:00 2008 +0200
     3.3 @@ -0,0 +1,82 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     3.6 +    <type>org.netbeans.modules.ant.freeform</type>
     3.7 +    <configuration>
     3.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
     3.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
    3.10 +            <name>testing template</name>
    3.11 +            <properties>
    3.12 +                <property name="ant.script">build.xml</property>
    3.13 +                <property name="apifest">../../../</property>
    3.14 +                <property-file>project.properties</property-file>
    3.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
    3.16 +            </properties>
    3.17 +            <folders>
    3.18 +                <source-folder>
    3.19 +                    <label>test</label>
    3.20 +                    <type>java</type>
    3.21 +                    <location>test</location>
    3.22 +                </source-folder>
    3.23 +            </folders>
    3.24 +            <ide-actions>
    3.25 +                <action name="build">
    3.26 +                    <script>${ant.script}</script>
    3.27 +                    <target>compile</target>
    3.28 +                </action>
    3.29 +                <action name="clean">
    3.30 +                    <script>${ant.script}</script>
    3.31 +                    <target>clean</target>
    3.32 +                </action>
    3.33 +                <action name="run">
    3.34 +                    <script>${ant.script}</script>
    3.35 +                    <target>test</target>
    3.36 +                </action>
    3.37 +                <action name="test">
    3.38 +                    <script>${ant.script}</script>
    3.39 +                    <target>test</target>
    3.40 +                </action>
    3.41 +                <action name="rebuild">
    3.42 +                    <script>${ant.script}</script>
    3.43 +                    <target>clean</target>
    3.44 +                    <target>compile</target>
    3.45 +                </action>
    3.46 +            </ide-actions>
    3.47 +            <export>
    3.48 +                <type>folder</type>
    3.49 +                <location>build/tests</location>
    3.50 +                <script>${ant.script}</script>
    3.51 +                <build-target>compile</build-target>
    3.52 +            </export>
    3.53 +            <view>
    3.54 +                <items>
    3.55 +                    <source-folder style="packages">
    3.56 +                        <label>test</label>
    3.57 +                        <location>test</location>
    3.58 +                    </source-folder>
    3.59 +                    <source-file>
    3.60 +                        <location>${ant.script}</location>
    3.61 +                    </source-file>
    3.62 +                    <source-file>
    3.63 +                        <location>project.properties</location>
    3.64 +                    </source-file>
    3.65 +                </items>
    3.66 +                <context-menu>
    3.67 +                    <ide-action name="build"/>
    3.68 +                    <ide-action name="clean"/>
    3.69 +                    <ide-action name="run"/>
    3.70 +                    <ide-action name="test"/>
    3.71 +                    <ide-action name="rebuild"/>
    3.72 +                </context-menu>
    3.73 +            </view>
    3.74 +            <subprojects/>
    3.75 +        </general-data>
    3.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
    3.77 +            <compilation-unit>
    3.78 +                <package-root>test</package-root>
    3.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
    3.80 +                <built-to>build/tests</built-to>
    3.81 +                <source-level>1.5</source-level>
    3.82 +            </compilation-unit>
    3.83 +        </java-data>
    3.84 +    </configuration>
    3.85 +</project>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/taskx/psmid/against-solution04/project.properties	Sat Oct 25 20:53:00 2008 +0200
     4.3 @@ -0,0 +1,16 @@
     4.4 +
     4.5 +# name of a project to test
     4.6 +#apitotest=todo:specify_this_property_in:project.properties
     4.7 +#for example use:
     4.8 +apitotest=solution04
     4.9 +
    4.10 +# the test shall expose a problem between two versions
    4.11 +# of one API. select the first version - taskA and a second
    4.12 +# version of the of the API taskB
    4.13 +taskA=${apifest}/task1
    4.14 +taskB=${apifest}/task2
    4.15 +
    4.16 +# usual locations of API classes for each version
    4.17 +apiA=${taskA}/${apitotest}/build/classes/
    4.18 +apiB=${taskB}/${apitotest}/build/classes/
    4.19 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/taskx/psmid/against-solution04/test/apifest/CurrencyTest.java	Sat Oct 25 20:53:00 2008 +0200
     5.3 @@ -0,0 +1,42 @@
     5.4 +package apifest;
     5.5 +
     5.6 +import java.math.BigDecimal;
     5.7 +import java.util.Currency;
     5.8 +import junit.framework.TestCase;
     5.9 +import org.apidesign.apifest08.currency.Convertor;
    5.10 +import org.apidesign.apifest08.currency.ConvertorFactory;
    5.11 +import org.apidesign.apifest08.currency.InvalidConversionException;
    5.12 +
    5.13 +
    5.14 +/** Write a test that works with version from task A and fails with version B.
    5.15 + */
    5.16 +public class CurrencyTest extends TestCase {
    5.17 +    public CurrencyTest(String n) {
    5.18 +        super(n);
    5.19 +    }
    5.20 +    
    5.21 +    public void testCompatibility() throws Exception {
    5.22 +        incompatibility1();
    5.23 +      //  incompatibility2(); //another test proving incompatibility in versions
    5.24 +      //  incompatibility3(); //another test proving incompatibility in versions
    5.25 +    }
    5.26 +
    5.27 +    private void incompatibility1() throws Exception {
    5.28 +          Convertor c = ConvertorFactory.getConvertor("CZK", BigDecimal.valueOf(17.0), "USD", BigDecimal.valueOf(1));
    5.29 +          assertTrue("", c.toString().startsWith("org.apidesign.apifest08.currency.ConvertorImpl"));
    5.30 +    }
    5.31 +
    5.32 +    private void incompatibility2() throws Exception {
    5.33 +          Convertor c = ConvertorFactory.getConvertor("CZK", BigDecimal.valueOf(17.0), "USD", BigDecimal.valueOf(1));
    5.34 +          assertEquals("Testing hashcode", 961187025, c.hashCode());
    5.35 +    }
    5.36 +
    5.37 +    private void incompatibility3() throws Exception {
    5.38 +        Convertor co = new Convertor() {
    5.39 +            public BigDecimal convert(Currency from, Currency to, BigDecimal amount) throws InvalidConversionException {
    5.40 +                return null;
    5.41 +            }
    5.42 +        };
    5.43 +    }
    5.44 +
    5.45 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/taskx/psmid/against-solution06/build.xml	Sat Oct 25 20:53:00 2008 +0200
     6.3 @@ -0,0 +1,5 @@
     6.4 +<?xml version="1.0" encoding="UTF-8"?>
     6.5 +<!-- this is a template file to test  -->
     6.6 +<project name="testing-template" default="run" basedir=".">
     6.7 +    <import file="../../common.xml"/>
     6.8 +</project>    
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/taskx/psmid/against-solution06/nbproject/project.xml	Sat Oct 25 20:53:00 2008 +0200
     7.3 @@ -0,0 +1,82 @@
     7.4 +<?xml version="1.0" encoding="UTF-8"?>
     7.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     7.6 +    <type>org.netbeans.modules.ant.freeform</type>
     7.7 +    <configuration>
     7.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
     7.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
    7.10 +            <name>testing template</name>
    7.11 +            <properties>
    7.12 +                <property name="ant.script">build.xml</property>
    7.13 +                <property name="apifest">../../../</property>
    7.14 +                <property-file>project.properties</property-file>
    7.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
    7.16 +            </properties>
    7.17 +            <folders>
    7.18 +                <source-folder>
    7.19 +                    <label>test</label>
    7.20 +                    <type>java</type>
    7.21 +                    <location>test</location>
    7.22 +                </source-folder>
    7.23 +            </folders>
    7.24 +            <ide-actions>
    7.25 +                <action name="build">
    7.26 +                    <script>${ant.script}</script>
    7.27 +                    <target>compile</target>
    7.28 +                </action>
    7.29 +                <action name="clean">
    7.30 +                    <script>${ant.script}</script>
    7.31 +                    <target>clean</target>
    7.32 +                </action>
    7.33 +                <action name="run">
    7.34 +                    <script>${ant.script}</script>
    7.35 +                    <target>test</target>
    7.36 +                </action>
    7.37 +                <action name="test">
    7.38 +                    <script>${ant.script}</script>
    7.39 +                    <target>test</target>
    7.40 +                </action>
    7.41 +                <action name="rebuild">
    7.42 +                    <script>${ant.script}</script>
    7.43 +                    <target>clean</target>
    7.44 +                    <target>compile</target>
    7.45 +                </action>
    7.46 +            </ide-actions>
    7.47 +            <export>
    7.48 +                <type>folder</type>
    7.49 +                <location>build/tests</location>
    7.50 +                <script>${ant.script}</script>
    7.51 +                <build-target>compile</build-target>
    7.52 +            </export>
    7.53 +            <view>
    7.54 +                <items>
    7.55 +                    <source-folder style="packages">
    7.56 +                        <label>test</label>
    7.57 +                        <location>test</location>
    7.58 +                    </source-folder>
    7.59 +                    <source-file>
    7.60 +                        <location>${ant.script}</location>
    7.61 +                    </source-file>
    7.62 +                    <source-file>
    7.63 +                        <location>project.properties</location>
    7.64 +                    </source-file>
    7.65 +                </items>
    7.66 +                <context-menu>
    7.67 +                    <ide-action name="build"/>
    7.68 +                    <ide-action name="clean"/>
    7.69 +                    <ide-action name="run"/>
    7.70 +                    <ide-action name="test"/>
    7.71 +                    <ide-action name="rebuild"/>
    7.72 +                </context-menu>
    7.73 +            </view>
    7.74 +            <subprojects/>
    7.75 +        </general-data>
    7.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
    7.77 +            <compilation-unit>
    7.78 +                <package-root>test</package-root>
    7.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
    7.80 +                <built-to>build/tests</built-to>
    7.81 +                <source-level>1.5</source-level>
    7.82 +            </compilation-unit>
    7.83 +        </java-data>
    7.84 +    </configuration>
    7.85 +</project>
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/taskx/psmid/against-solution06/project.properties	Sat Oct 25 20:53:00 2008 +0200
     8.3 @@ -0,0 +1,16 @@
     8.4 +
     8.5 +# name of a project to test
     8.6 +#apitotest=todo:specify_this_property_in:project.properties
     8.7 +#for example use:
     8.8 +apitotest=solution06
     8.9 +
    8.10 +# the test shall expose a problem between two versions
    8.11 +# of one API. select the first version - taskA and a second
    8.12 +# version of the of the API taskB
    8.13 +taskA=${apifest}/task3
    8.14 +taskB=${apifest}/task4
    8.15 +
    8.16 +# usual locations of API classes for each version
    8.17 +apiA=${taskA}/${apitotest}/build/classes/
    8.18 +apiB=${taskB}/${apitotest}/build/classes/
    8.19 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/taskx/psmid/against-solution06/test/apifest/CurrencyTest.java	Sat Oct 25 20:53:00 2008 +0200
     9.3 @@ -0,0 +1,34 @@
     9.4 +package apifest;
     9.5 +
     9.6 +import java.math.BigDecimal;
     9.7 +import java.util.Currency;
     9.8 +import junit.framework.TestCase;
     9.9 +import org.apidesign.apifest08.currency.Amount;
    9.10 +import org.apidesign.apifest08.currency.Convertor;
    9.11 +import org.apidesign.apifest08.currency.UnsupportedConversionException;
    9.12 +//import static org.apidesign.apifest08.test.Currencies.CZK;
    9.13 +//import static org.apidesign.apifest08.test.Currencies.SKK;
    9.14 +//import static org.apidesign.apifest08.test.Currencies.USD;
    9.15 +
    9.16 +/** Write a test that works with version from task A and fails with version B.
    9.17 + */
    9.18 +public class CurrencyTest extends TestCase {
    9.19 +    public CurrencyTest(String n) {
    9.20 +        super(n);
    9.21 +    }
    9.22 +    
    9.23 +    public void testCompatibility() throws Exception {
    9.24 +        Currency CZK = Currency.getInstance("CZK");
    9.25 +        Currency USD = Currency.getInstance("USD");
    9.26 +        Currency SKK = Currency.getInstance("SKK");
    9.27 +
    9.28 +
    9.29 +        Convertor c = new Convertor(new BigDecimal(17), USD, CZK);
    9.30 +        try {
    9.31 +            Amount a = c.convert(new BigDecimal("10"), USD, SKK);
    9.32 +            //fail();
    9.33 +        } catch (UnsupportedConversionException e) {
    9.34 +            assertEquals("Conversion from  the currency USD to the currency SKK or vice versa in not supported.", e.getMessage());
    9.35 +        }
    9.36 +    }
    9.37 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/taskx/psmid/against-solution11/build.xml	Sat Oct 25 20:53:00 2008 +0200
    10.3 @@ -0,0 +1,5 @@
    10.4 +<?xml version="1.0" encoding="UTF-8"?>
    10.5 +<!-- this is a template file to test  -->
    10.6 +<project name="testing-template" default="run" basedir=".">
    10.7 +    <import file="../../common.xml"/>
    10.8 +</project>    
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/taskx/psmid/against-solution11/nbproject/project.xml	Sat Oct 25 20:53:00 2008 +0200
    11.3 @@ -0,0 +1,82 @@
    11.4 +<?xml version="1.0" encoding="UTF-8"?>
    11.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    11.6 +    <type>org.netbeans.modules.ant.freeform</type>
    11.7 +    <configuration>
    11.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
    11.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
   11.10 +            <name>testing template</name>
   11.11 +            <properties>
   11.12 +                <property name="ant.script">build.xml</property>
   11.13 +                <property name="apifest">../../../</property>
   11.14 +                <property-file>project.properties</property-file>
   11.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
   11.16 +            </properties>
   11.17 +            <folders>
   11.18 +                <source-folder>
   11.19 +                    <label>test</label>
   11.20 +                    <type>java</type>
   11.21 +                    <location>test</location>
   11.22 +                </source-folder>
   11.23 +            </folders>
   11.24 +            <ide-actions>
   11.25 +                <action name="build">
   11.26 +                    <script>${ant.script}</script>
   11.27 +                    <target>compile</target>
   11.28 +                </action>
   11.29 +                <action name="clean">
   11.30 +                    <script>${ant.script}</script>
   11.31 +                    <target>clean</target>
   11.32 +                </action>
   11.33 +                <action name="run">
   11.34 +                    <script>${ant.script}</script>
   11.35 +                    <target>test</target>
   11.36 +                </action>
   11.37 +                <action name="test">
   11.38 +                    <script>${ant.script}</script>
   11.39 +                    <target>test</target>
   11.40 +                </action>
   11.41 +                <action name="rebuild">
   11.42 +                    <script>${ant.script}</script>
   11.43 +                    <target>clean</target>
   11.44 +                    <target>compile</target>
   11.45 +                </action>
   11.46 +            </ide-actions>
   11.47 +            <export>
   11.48 +                <type>folder</type>
   11.49 +                <location>build/tests</location>
   11.50 +                <script>${ant.script}</script>
   11.51 +                <build-target>compile</build-target>
   11.52 +            </export>
   11.53 +            <view>
   11.54 +                <items>
   11.55 +                    <source-folder style="packages">
   11.56 +                        <label>test</label>
   11.57 +                        <location>test</location>
   11.58 +                    </source-folder>
   11.59 +                    <source-file>
   11.60 +                        <location>${ant.script}</location>
   11.61 +                    </source-file>
   11.62 +                    <source-file>
   11.63 +                        <location>project.properties</location>
   11.64 +                    </source-file>
   11.65 +                </items>
   11.66 +                <context-menu>
   11.67 +                    <ide-action name="build"/>
   11.68 +                    <ide-action name="clean"/>
   11.69 +                    <ide-action name="run"/>
   11.70 +                    <ide-action name="test"/>
   11.71 +                    <ide-action name="rebuild"/>
   11.72 +                </context-menu>
   11.73 +            </view>
   11.74 +            <subprojects/>
   11.75 +        </general-data>
   11.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
   11.77 +            <compilation-unit>
   11.78 +                <package-root>test</package-root>
   11.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
   11.80 +                <built-to>build/tests</built-to>
   11.81 +                <source-level>1.5</source-level>
   11.82 +            </compilation-unit>
   11.83 +        </java-data>
   11.84 +    </configuration>
   11.85 +</project>
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/taskx/psmid/against-solution11/project.properties	Sat Oct 25 20:53:00 2008 +0200
    12.3 @@ -0,0 +1,16 @@
    12.4 +
    12.5 +# name of a project to test
    12.6 +#apitotest=todo:specify_this_property_in:project.properties
    12.7 +#for example use:
    12.8 +apitotest=solution11
    12.9 +
   12.10 +# the test shall expose a problem between two versions
   12.11 +# of one API. select the first version - taskA and a second
   12.12 +# version of the of the API taskB
   12.13 +taskA=${apifest}/task1
   12.14 +taskB=${apifest}/task2
   12.15 +
   12.16 +# usual locations of API classes for each version
   12.17 +apiA=${taskA}/${apitotest}/build/classes/
   12.18 +apiB=${taskB}/${apitotest}/build/classes/
   12.19 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/taskx/psmid/against-solution11/test/apifest/CurrencyTest.java	Sat Oct 25 20:53:00 2008 +0200
    13.3 @@ -0,0 +1,29 @@
    13.4 +package apifest;
    13.5 +
    13.6 +import junit.framework.TestCase;
    13.7 +import org.apidesign.apifest08.currency.Convertor;
    13.8 +import org.apidesign.apifest08.currency.CurrencyValue;
    13.9 +//import static org.apidesign.apifest08.test.Currencies.CZK;
   13.10 +//import static org.apidesign.apifest08.test.Currencies.SKK;
   13.11 +//import static org.apidesign.apifest08.test.Currencies.USD;
   13.12 +
   13.13 +/** Write a test that works with version from task A and fails with version B.
   13.14 + */
   13.15 +public class CurrencyTest extends TestCase {
   13.16 +    public CurrencyTest(String n) {
   13.17 +        super(n);
   13.18 +    }
   13.19 +
   13.20 +    public void testCompatibility() throws Exception {
   13.21 +        try {
   13.22 +            Convertor c = Convertor.getConvertorIntegerString(
   13.23 +                CurrencyValue.getCurrencyValue(1, "CZK"),
   13.24 +                CurrencyValue.getCurrencyValue(1, "CZK")
   13.25 +            );
   13.26 +            c.convert("CZK", CurrencyValue.getCurrencyValue(10, "CZK"));
   13.27 +            fail("Should throw exception");
   13.28 +        } catch (IllegalArgumentException e) {
   13.29 +            //ok
   13.30 +        }
   13.31 +    }
   13.32 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/taskx/psmid/against-solution13/build.xml	Sat Oct 25 20:53:00 2008 +0200
    14.3 @@ -0,0 +1,5 @@
    14.4 +<?xml version="1.0" encoding="UTF-8"?>
    14.5 +<!-- this is a template file to test  -->
    14.6 +<project name="testing-template" default="run" basedir=".">
    14.7 +    <import file="../../common.xml"/>
    14.8 +</project>    
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/taskx/psmid/against-solution13/nbproject/project.xml	Sat Oct 25 20:53:00 2008 +0200
    15.3 @@ -0,0 +1,82 @@
    15.4 +<?xml version="1.0" encoding="UTF-8"?>
    15.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    15.6 +    <type>org.netbeans.modules.ant.freeform</type>
    15.7 +    <configuration>
    15.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
    15.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
   15.10 +            <name>testing template</name>
   15.11 +            <properties>
   15.12 +                <property name="ant.script">build.xml</property>
   15.13 +                <property name="apifest">../../../</property>
   15.14 +                <property-file>project.properties</property-file>
   15.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
   15.16 +            </properties>
   15.17 +            <folders>
   15.18 +                <source-folder>
   15.19 +                    <label>test</label>
   15.20 +                    <type>java</type>
   15.21 +                    <location>test</location>
   15.22 +                </source-folder>
   15.23 +            </folders>
   15.24 +            <ide-actions>
   15.25 +                <action name="build">
   15.26 +                    <script>${ant.script}</script>
   15.27 +                    <target>compile</target>
   15.28 +                </action>
   15.29 +                <action name="clean">
   15.30 +                    <script>${ant.script}</script>
   15.31 +                    <target>clean</target>
   15.32 +                </action>
   15.33 +                <action name="run">
   15.34 +                    <script>${ant.script}</script>
   15.35 +                    <target>test</target>
   15.36 +                </action>
   15.37 +                <action name="test">
   15.38 +                    <script>${ant.script}</script>
   15.39 +                    <target>test</target>
   15.40 +                </action>
   15.41 +                <action name="rebuild">
   15.42 +                    <script>${ant.script}</script>
   15.43 +                    <target>clean</target>
   15.44 +                    <target>compile</target>
   15.45 +                </action>
   15.46 +            </ide-actions>
   15.47 +            <export>
   15.48 +                <type>folder</type>
   15.49 +                <location>build/tests</location>
   15.50 +                <script>${ant.script}</script>
   15.51 +                <build-target>compile</build-target>
   15.52 +            </export>
   15.53 +            <view>
   15.54 +                <items>
   15.55 +                    <source-folder style="packages">
   15.56 +                        <label>test</label>
   15.57 +                        <location>test</location>
   15.58 +                    </source-folder>
   15.59 +                    <source-file>
   15.60 +                        <location>${ant.script}</location>
   15.61 +                    </source-file>
   15.62 +                    <source-file>
   15.63 +                        <location>project.properties</location>
   15.64 +                    </source-file>
   15.65 +                </items>
   15.66 +                <context-menu>
   15.67 +                    <ide-action name="build"/>
   15.68 +                    <ide-action name="clean"/>
   15.69 +                    <ide-action name="run"/>
   15.70 +                    <ide-action name="test"/>
   15.71 +                    <ide-action name="rebuild"/>
   15.72 +                </context-menu>
   15.73 +            </view>
   15.74 +            <subprojects/>
   15.75 +        </general-data>
   15.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
   15.77 +            <compilation-unit>
   15.78 +                <package-root>test</package-root>
   15.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
   15.80 +                <built-to>build/tests</built-to>
   15.81 +                <source-level>1.5</source-level>
   15.82 +            </compilation-unit>
   15.83 +        </java-data>
   15.84 +    </configuration>
   15.85 +</project>
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/taskx/psmid/against-solution13/project.properties	Sat Oct 25 20:53:00 2008 +0200
    16.3 @@ -0,0 +1,16 @@
    16.4 +
    16.5 +# name of a project to test
    16.6 +#apitotest=todo:specify_this_property_in:project.properties
    16.7 +#for example use:
    16.8 +apitotest=solution13
    16.9 +
   16.10 +# the test shall expose a problem between two versions
   16.11 +# of one API. select the first version - taskA and a second
   16.12 +# version of the of the API taskB
   16.13 +taskA=${apifest}/task1
   16.14 +taskB=${apifest}/task2
   16.15 +
   16.16 +# usual locations of API classes for each version
   16.17 +apiA=${taskA}/${apitotest}/build/classes/
   16.18 +apiB=${taskB}/${apitotest}/build/classes/
   16.19 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/taskx/psmid/against-solution13/test/apifest/CurrencyTest.java	Sat Oct 25 20:53:00 2008 +0200
    17.3 @@ -0,0 +1,26 @@
    17.4 +package apifest;
    17.5 +
    17.6 +import junit.framework.TestCase;
    17.7 +import org.apidesign.apifest08.currency.ConvertorCurrency;
    17.8 +import org.apidesign.apifest08.currency.ExchangeRate;
    17.9 +import org.apidesign.apifest08.currency.ExchangeRateProvider;
   17.10 +
   17.11 +
   17.12 +/** Write a test that works with version from task A and fails with version B.
   17.13 + */
   17.14 +
   17.15 +public class CurrencyTest extends TestCase {
   17.16 +
   17.17 +
   17.18 +    public CurrencyTest(String n) {
   17.19 +        super(n);
   17.20 +    }
   17.21 +    
   17.22 +    public void testCompatibility() throws Exception {
   17.23 +       ExchangeRateProvider e = new ExchangeRateProvider(null, null, null, null) {
   17.24 +           private ExchangeRate getExchangeRate(ConvertorCurrency a, ConvertorCurrency b) { //in version B it shouln't compile
   17.25 +               return null;
   17.26 +           }
   17.27 +       };
   17.28 +    }
   17.29 +}