@Test
	public void testSortingInterface() throws Exception
	{
		PersistenceManager pm = null;
		if(driver != null)
		{
			pm = new PersistenceManager(driver, database, login, password);
		}
		else
		{
			//we're dealing with a 4.0 or better driver, omit driver specification.
			pm = new PersistenceManager( database, login, password);
		}
		// drop all tables
		pm.dropTable(Object.class);

		// create test data
		for (int x = 0; x < 10; x++)
		{
			// alternate FooSortable and BarSortable
			Sortable s = null;
			if (x % 2 == 0)
			{
				s = new FooSortable();
			} else
			{
				s = new BarSortable();
			}
			s.setFoo(x);
			pm.saveObject(s);
		}

		// retrieve the test data, sorted ascending
		FooSortable sortObject = new FooSortable();
		sortObject.setFoo(1);
		List<Sortable> sortable = pm.getObjects(Sortable.class, new All(), new Ascending(sortObject, Sortable.class));
		assertEquals(10, sortable.size());

		// make sure everything is in the right order
		int lastValue = 0;
		for (Sortable s : sortable)
		{
			assertEquals(lastValue, s.getFoo().intValue());
			lastValue++;
		}
		

		// retrieve the test data, sorted descending
		sortable = pm.getObjects(Sortable.class, new All(), new Descending(sortObject, Sortable.class));
		assertEquals(10, sortable.size());

		// make sure everything is in the right order
		for (Sortable s : sortable)
		{
			lastValue--;
			assertEquals(lastValue, s.getFoo().intValue());
		}

		pm.close();
	}