public void testLoadFloorPlan() throws Exception {
		String testFile = prepareTestFile();

		Document doc = FloorPlanUtility.loadFromString(testFile);
		FloorPlan floorPlan = FloorPlanUtility.loadFloorPlan(doc);

		BufferedReader reader = new BufferedReader(new StringReader(testFile));

		String line = reader.readLine();
		assertNotNull(line);
		assertEquals("<?xml version=\"1.0\" encoding=\"utf-8\"?>", line.trim());
		System.out.println(line);

		line = reader.readLine();
		assertNotNull(line);
		assertEquals("<home>", line.trim());
		System.out.println(line);

		Floor floor = null;
		while (true) {
			line = reader.readLine();

			if (line == null) {
				break;
			}

			// if this is a floor, test the floor
			if (line.contains("<floor")) {
				System.out.println(line);
				assertTrue(line.contains("level='"));
				String level = line.substring(line.indexOf("level='") + 7, line.indexOf("'>"));
				int lvl = Integer.parseInt(level);

				boolean floorIsPresent = false;
				for (int i = 0; i < floorPlan.numberOfFloors(); i++) {
					floor = floorPlan.getFloor(i);

					if (floor.getLevel() == lvl) {
						floorIsPresent = true;
						break;
					}
				}

				assertTrue(floorIsPresent);

			}
			// if this is a cell, test the cell
			else if (line.contains("<cell")) {
				System.out.println(line);

				int xsIndex = line.indexOf("xs='") + 4;
				String xs = line.substring(xsIndex, line.indexOf("'", xsIndex));
				int xPos = Integer.parseInt(xs);

				int ysIndex = line.indexOf("ys='") + 4;
				String ys = line.substring(ysIndex, line.indexOf("'", ysIndex));
				int yPos = Integer.parseInt(ys);

				assertNotNull(floor);
				Tile tile = floor.getTile(xPos, yPos);
				assertNotNull(tile);

				int ssIndex = line.indexOf("ss='") + 4;
				String ss = line.substring(ssIndex, line.indexOf("'", ssIndex));
				int surface = Integer.parseInt(ss);
				
				assertEquals(surface, tile.getSurfaceType());

				int psIndex = line.indexOf("ps='") + 4;
				String paths = line.substring(psIndex, line.indexOf("'", psIndex));
				
				int right = Integer.parseInt(paths.substring(0, 1));
				int left = Integer.parseInt(paths.substring(1, 2));
				int up = Integer.parseInt(paths.substring(2, 3));
				int down = Integer.parseInt(paths.substring(3, 4));

				assertEquals(right, tile.getRightPath());
				assertEquals(left, tile.getLeftPath());
				assertEquals(up, tile.getUpperPath());
				assertEquals(down, tile.getLowerPath());
				
				int dsIndex = line.indexOf("ds='") + 4;
				String ds = line.substring(dsIndex, line.indexOf("'", dsIndex));
				int dirt = Integer.parseInt(ds);
				assertEquals(dirt, tile.getDirtAmount());
				
				int csIndex = line.indexOf("cs='") + 4;
				String cs = line.substring(csIndex, line.indexOf("'", csIndex));
				int home = Integer.parseInt(cs);
				
				boolean isHome;				
				if (home == 0)
				{
					isHome = false;
				}
				else
				{
					isHome = true;
				}
				
				assertNotNull(home);
				assertEquals(isHome, tile.isChargingStation());
			}
			// if this is neither floor nor cell, ignore it
		}

		try {
			reader.close();
		} catch (Exception e) {
			// at least we tried
		}
	}