package edu.oregonstate.eecs.shp3d;

import java.io.IOException;

import org.junit.Assert;
import org.junit.Test;

public class DEMConnectionTest {
	private static final String MIKE_DEM = "http://maverick.coas.oregonstate.edu:11300/" +
			"terrainextraction.ashx?";
	@Test
	public void testConnection() throws IOException {
		final int numLats = 10;
		final int numLngs = 10;

		String urlString = DEMQueryBuilder.startBuilding(MIKE_DEM)
				.withLat1(40.95f)
				.withLat2(41.0f)
				.withLng1(-122.95f)
				.withLng2(-123.0f)
				.withNumLats(numLats)
				.withNumLngs(numLngs)
			.build();

		DEMConnection connection = new DEMConnection(urlString);
		DEMConnection.XTRHeader header = connection.getXTRHeader();
		Assert.assertEquals(numLats, header.numLats);
		Assert.assertEquals(numLngs, header.numLngs);

		for (int i=0; i<header.numLats; i++) {
			for (int j=0; j<header.numLngs; j++) {
				System.out.print(String.valueOf(connection.heightAtIndex(i, j)) + " ");
			}
			System.out.println("");
		}
	}
}

@@ -368,16 +368,176 @@
 gs = 10;
+%0A%09%09final float minLat = 40.95f;%0A%09%09final float maxLat = 41.0f;%0A%09%09final float minLng = -123.0f;%0A%09%09final float maxLng = -122.95f;%0A%09%09final float epsilon = 1e-8f;%0A%09%09
 %0A%0A%09%09Stri
@@ -605,22 +605,22 @@
 ithLat1(
-40.95f
+minLat
 )%0A%09%09%09%09.w
@@ -627,21 +627,22 @@
 ithLat2(
-41.0f
+maxLat
 )%0A%09%09%09%09.w
@@ -649,24 +649,22 @@
 ithLng1(
--122.95f
+minLng
 )%0A%09%09%09%09.w
@@ -671,23 +671,22 @@
 ithLng2(
--123.0f
+maxLng
 )%0A%09%09%09%09.w
@@ -961,16 +961,236 @@
 umLngs);
+%0A%09%09Assert.assertEquals(minLat, header.minLat, epsilon);%0A%09%09Assert.assertEquals(maxLat, header.maxLat, epsilon);%0A%09%09Assert.assertEquals(minLng, header.minLng, epsilon);%0A%09%09Assert.assertEquals(maxLng, header.maxLng, epsilon);
 %0A%0A%09%09for 

make the test more rigorous.