Skip to content

Commit 1104f67

Browse files
author
atsticks
committed
Updated TCK and example integration.
1 parent 27e961c commit 1104f67

File tree

3 files changed

+68
-14
lines changed

3 files changed

+68
-14
lines changed

money-ri-test.iml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111
<orderEntry type="inheritedJdk" />
1212
<orderEntry type="sourceFolder" forTests="false" />
1313
<orderEntry type="module" module-name="money-tck" />
14+
<orderEntry type="library" name="Maven: org.mutabilitydetector:MutabilityDetector:0.9.1" level="project" />
15+
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.2" level="project" />
16+
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
1417
<orderEntry type="module" module-name="money-api" />
1518
<orderEntry type="library" name="Maven: org.testng:testng:6.8.5" level="project" />
1619
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
17-
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
1820
<orderEntry type="library" name="Maven: org.beanshell:bsh:2.0b4" level="project" />
1921
<orderEntry type="library" name="Maven: com.beust:jcommander:1.27" level="project" />
2022
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.6" level="project" />
21-
<orderEntry type="module" module-name="jboss-test-audit-api" />
22-
<orderEntry type="module" module-name="jboss-test-audit-impl" />
23+
<orderEntry type="library" name="Maven: org.jboss.test-audit:jboss-test-audit-api:1.1.0.Final" level="project" />
24+
<orderEntry type="library" name="Maven: org.jboss.test-audit:jboss-test-audit-impl:1.1.0.Final" level="project" />
2325
<orderEntry type="module" module-name="moneta" />
2426
</component>
2527
</module>

src/main/java/MonetaTCKSetup.java

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright (c) 2012, 2014, Credit Suisse (Anatole Tresch), Werner Keil and others by the @author tag.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
117
import org.javamoney.moneta.FastMoney;
218
import org.javamoney.moneta.function.MonetaryFunctions;
319
import org.javamoney.tck.JSR354TestConfiguration;
@@ -13,30 +29,50 @@
1329
import java.util.List;
1430

1531
/**
16-
* Created by Anatole on 14.06.2014.
32+
* JSR354TestConfiguration setup class. This is an example TCK setup class, that has to be written by
33+
* implementors to setup the JSR 354 TCK for running with their implementations.
34+
* <p>
35+
* Created by Anatole Tresch on 14.06.2014.
1736
*/
18-
public final class MonetaTCKSetup implements JSR354TestConfiguration{
37+
public final class MonetaTCKSetup implements JSR354TestConfiguration {
1938

39+
/**
40+
* Provide the MonetaryAmount implementation classes to be tested for immutability and other
41+
* implementation requirements.
42+
*
43+
* @return the monetary amount classes to be tested, not null and not empty.
44+
*/
2045
@Override
2146
public Collection<Class> getAmountClasses() {
2247
return Arrays
2348
.asList(new Class[]{FastMoney.class, FastMoney.class});
2449
}
2550

51+
/**
52+
* Provide the CurrencyUnit implementation classes to be tested for immutability and other
53+
* implementation requirements.
54+
*
55+
* @return the currency unit classes to be tested, not null and not empty.
56+
*/
2657
@Override
2758
public Collection<Class> getCurrencyClasses() {
28-
try{
59+
try {
2960
return Arrays
30-
.asList(new Class[] { Class.forName("org.javamoney.moneta.internal.JDKCurrencyAdapter")});
31-
}
32-
catch(ClassNotFoundException e){
61+
.asList(new Class[]{Class.forName("org.javamoney.moneta.internal.JDKCurrencyAdapter")});
62+
} catch (ClassNotFoundException e) {
3363
e.printStackTrace();
3464
throw new RuntimeException("Currency class not lodable: org.javamoney.moneta.internal.JDKCurrencyAdapter");
3565
}
3666
}
3767

68+
/**
69+
* Provide the MonetaryOperator implementation classes to be tested for immutability and other
70+
* implementation requirements.
71+
*
72+
* @return the monetary operator classes to be tested, not null and not empty.
73+
*/
3874
@Override
39-
public Collection<MonetaryOperator> getMonetaryOperators4Test(){
75+
public Collection<MonetaryOperator> getMonetaryOperators4Test() {
4076
List<MonetaryOperator> ops = new ArrayList<>();
4177
ops.add(MonetaryFunctions.majorPart());
4278
ops.add(MonetaryFunctions.minorPart());
@@ -46,7 +82,7 @@ public Collection<MonetaryOperator> getMonetaryOperators4Test(){
4682
ops.add(MonetaryFunctions.permil(BigDecimal.ONE));
4783
ops.add(MonetaryFunctions.permil(10.5, MathContext.DECIMAL32));
4884
ops.add(MonetaryFunctions.reciprocal());
49-
ops.add(MonetaryRoundings.getRounding());
85+
ops.add(MonetaryRoundings.getDefaultRounding());
5086
ops.add(MonetaryConversions.getConversion("EUR"));
5187
return ops;
5288
}

src/main/java/RunTCK.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
/**
2+
* Copyright (c) 2012, 2014, Credit Suisse (Anatole Tresch), Werner Keil and others by the @author tag.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
117
import org.javamoney.tck.TCKRunner;
218

319
/**
4-
* Created by Anatole on 14.06.2014.
20+
* TCK Runner (only for IDE). Created by Anatole on 14.06.2014.
521
*/
6-
public class RunTCK{
22+
public class RunTCK {
723

8-
public static void main(String[] args){
24+
public static void main(String[] args) {
925
TCKRunner.main(args);
1026
}
1127
}

0 commit comments

Comments
 (0)