Project

General

Profile

Revision df2d3d89

IDdf2d3d8909e1e5058d584e3b79bbad1cbb583637
Parent 862cd930
Child b1d3185d

Added by Niels Hoffmann about 10 years ago

UTF8 for Coordinate Conversion

View differences:

cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/location/PointTest.java
28 28
 *
29 29
 */
30 30
public class PointTest {
31
	@SuppressWarnings("unused")
31 32
	private static final Logger logger = Logger.getLogger(PointTest.class);
32 33

  
33 34
	private Point point1;
......
121 122
	
122 123
	@Test
123 124
	public void testGetLongitudeSexagesimal(){
124
		Assert.assertEquals("23?7'25\"E", point1.getLongitudeSexagesimal().toString(true));
125
		Assert.assertEquals("23\u00B07'25\"E", point1.getLongitudeSexagesimal().toString(true));
125 126
		
126 127
		point2.setLongitudeSexagesimal(Sexagesimal.NewInstance(5, 22, null, Direction.WEST));
127 128
		Assert.assertTrue(point2.getLongitudeSexagesimal().minutes == 22);
......
143 144
		try {
144 145
			Assert.assertEquals("", longitude1, point1.getLongitude());
145 146
			Assert.assertTrue("", latitude1.equals(point1.getLatitude()));
146
			point1.setLatitudeByParsing("35?34'20\"S");
147
			point1.setLatitudeByParsing("35\u00B034'20\"S");
147 148
			Assert.assertEquals("", longitude1, point1.getLongitude());
148 149
			Assert.assertFalse("", latitude1.equals(point1.getLatitude()));
149 150
			Assert.assertEquals("", Double.valueOf("-35.57222222222222"), point1.getLatitude());
......
151 152
			Assert.fail("No parsing error should occur");
152 153
		}
153 154
		try {
154
			point1.setLongitudeByParsing("112?34.34'N");
155
			point1.setLongitudeByParsing("112\u00B034.34'N");
155 156
			Assert.assertEquals("", "112.57233", point1.getLongitude().toString().substring(0,9));
156 157
		} catch (ParseException e) {
157 158
			Assert.fail("No parsing error should occur");
158 159
		}
159 160
		try {
160
			point1.setLatitudeByParsing("112?34.34'S");
161
			point1.setLatitudeByParsing("112\u00B034.34'S");
161 162
			Assert.fail("Latitude can not be > 90");
162 163
		} catch (ParseException e) {
163 164
			Assert.assertTrue("Latitude can not be > 90", true);
164 165
		}
165 166
		try {
166
			point1.setLongitudeByParsing("45?34.34'S");
167
			point1.setLongitudeByParsing("45\u00B034.34'S");
167 168
			Assert.fail("Longitude can not be S");
168 169
		} catch (ParseException e) {
169 170
			Assert.assertTrue("Longitude can not be S", true);
......
174 175
//		Assert.assertTrue("Southern must be negative", conversionResults.convertedCoord < 0);
175 176
//		Assert.assertFalse("Southern must be latitude", conversionResults.isLongitude);
176 177
//
177
//		conversionResults = coordinateConverter.tryConvert("35?34.744");
178
//		conversionResults = coordinateConverter.tryConvert("35\u00B034.744");
178 179
//		Assert.assertTrue(conversionResults.conversionComments, conversionResults.patternRecognised);
179 180
//		Assert.assertNull("Longitude must be undefined", conversionResults.isLongitude);
180 181
//
181
//		conversionResults = coordinateConverter.tryConvert("95?34.744");
182
//		conversionResults = coordinateConverter.tryConvert("95\u00B034.744");
182 183
//		Assert.assertTrue("Longitude must be defined", conversionResults.isLongitude);
183 184
//
184 185
//		
185
//		conversionResults = coordinateConverter.tryConvert("-35?34'55.67S");
186
//		conversionResults = coordinateConverter.tryConvert("-35\u00B034'55.67S");
186 187
//		Assert.assertTrue(conversionResults.conversionComments, conversionResults.patternRecognised);
187 188
//
188
//		conversionResults = coordinateConverter.tryConvert("35?11'34.744SN");
189
//		conversionResults = coordinateConverter.tryConvert("35\u00B011'34.744SN");
189 190
//		Assert.assertTrue(conversionResults.conversionComments, conversionResults.patternRecognised);
190 191
//
191
//		conversionResults = coordinateConverter.tryConvert("35?11'34.744SW");
192
//		conversionResults = coordinateConverter.tryConvert("35\u00B011'34.744SW");
192 193
//		Assert.assertTrue("Western must be longitude", conversionResults.isLongitude);
193 194
//		
194 195
//		conversionResults = coordinateConverter.tryConvert("35D11M34.744S");

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)