public void testRemote() {
MockPersistenceManager mock = new MockPersistenceManager();
PersistenceManagerFactory.install(mock, Person.class);
RemotePersistenceManager remote = new RemotePersistenceManager();
Properties properties = new Properties();
properties.setProperty("connector", MockConnector.class.getName());
properties.setProperty("serializer", MockConnector.class.getName());
remote.init(properties);
remote.insert(TESLA);
assertEquals("insert", mock.action);
assertEquals(TESLA, mock.object);
remote.update(TESLA);
assertEquals("update", mock.action);
assertEquals(TESLA, mock.object);
Person expected = new Person();
expected.id = TESLA.id;
remote.delete(TESLA);
assertEquals("delete", mock.action);
assertEquals(expected, mock.object);
remote.get(TESLA);
assertEquals("get", mock.action);
assertEquals(expected, mock.object);
remote.createQuery(Person.class).fetch();
assertEquals(0, mock.lastQuery.filters.size());
assertEquals(0, mock.lastQuery.orders.size());
remote.createQuery(Person.class).order("firstName").order("lastName").fetch();
assertEquals(0, mock.lastQuery.filters.size());
assertEquals(Arrays.asList("firstName", "lastName"), mock.lastQuery.orders);
remote.createQuery(Person.class)
.filter("city", "Ulm")
.filter("firstName", "Albert")
.filter("lastName", null)
.order("firstName")
.order("lastName")