| /* Copyright 2004 The Apache Software Foundation |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package drtcases; |
| |
| import junit.framework.Test; |
| import junit.framework.TestSuite; |
| import junit.framework.TestCase; |
| import junit.framework.Assert; |
| |
| import xint.test.PositionDocument; |
| |
| public class IntTests extends TestCase |
| { |
| public IntTests(String name) { super(name); } |
| public static Test suite() { return new TestSuite(IntTests.class); } |
| |
| public static void testLatLong() throws Exception |
| { |
| PositionDocument doc = PositionDocument.Factory.parse( |
| "<p:position xmlns:p='java:int.test'><p:lat>43</p:lat><p:lon>020</p:lon></p:position>"); |
| Assert.assertEquals(43, doc.getPosition().getLat()); |
| Assert.assertEquals(20, doc.getPosition().getLon()); |
| doc.getPosition().xgetLat().set("07"); |
| doc.getPosition().xgetLon().set("040"); |
| Assert.assertEquals(7, doc.getPosition().getLat()); |
| Assert.assertEquals(40, doc.getPosition().getLon()); |
| doc.getPosition().setLat((short)22); |
| } |
| } |