1 /* Copyright 2004 The Apache Software Foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * 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 { 28 private static QName deposit = new QName( "http://statement", "deposit" ); 29 30 public static void main ( String[] args ) throws Exception 31 { 32 StatementDocument stmtDoc = StatementDocument.Factory.parse( new File( args[ 0 ] ) ); 33 34 if (!stmtDoc.validate()) 35 throw new RuntimeException("expected valid instance: " + args[0]); 36 37 float balance = OrderMatters.balanceOutOfOrder(stmtDoc); 38 if (1010F != balance) 39 throw new RuntimeException("expected out of order to return $1010.0: " + balance); 40 41 balance = OrderMatters.balanceInOrder(stmtDoc); 42 if (960F != balance) 43 throw new RuntimeException("expected in order to return $960.0: " + balance); 44 } 45 46 }