01: /* Copyright 2004 The Apache Software Foundation
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software
10: * distributed under the License is distributed on an "AS IS" BASIS,
11: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: * See the License for the specific language governing permissions and
13: * limitations under the License.
14: */
15: package org.apache.xmlbeans.samples.cursor;
16:
17: import statement.StatementDocument;
18: import statement.StatementDocument.Statement;
19: import statement.Transaction;
20: import java.io.File;
21:
22: import org.apache.xmlbeans.XmlCursor;
23:
24: import javax.xml.namespace.QName;
25:
26: public class OrderMattersTest {
27: private static QName deposit = new QName("http://statement",
28: "deposit");
29:
30: public static void main(String[] args) throws Exception {
31: StatementDocument stmtDoc = StatementDocument.Factory
32: .parse(new File(args[0]));
33:
34: if (!stmtDoc.validate())
35: throw new RuntimeException("expected valid instance: "
36: + args[0]);
37:
38: float balance = OrderMatters.balanceOutOfOrder(stmtDoc);
39: if (1010F != balance)
40: throw new RuntimeException(
41: "expected out of order to return $1010.0: "
42: + balance);
43:
44: balance = OrderMatters.balanceInOrder(stmtDoc);
45: if (960F != balance)
46: throw new RuntimeException(
47: "expected in order to return $960.0: " + balance);
48: }
49:
50: }
|