@Test
public void testMapping() {
final BasicDAO<User, ObjectId> messageDAO = new BasicDAO<User, ObjectId>(User.class, getDs());
Assert.assertNotNull(messageDAO);
Mapper mapper = new Mapper();
User user = new User();
user.id = 1;
user.userObject = "just a String";
DBObject dbObject = mapper.toDBObject(user);
Object object = mapper.fromDBObject(User.class, dbObject, new DefaultEntityCache());
Assert.assertEquals(user.userObject, ((User) object).userObject);
user.userObject = 33;
dbObject = mapper.toDBObject(user);
object = mapper.fromDBObject(User.class, dbObject, new DefaultEntityCache());
Assert.assertEquals(user.userObject, ((User) object).userObject);
user.userObject = 33.3;
dbObject = mapper.toDBObject(user);
object = mapper.fromDBObject(User.class, dbObject, new DefaultEntityCache());
Assert.assertEquals(user.userObject, ((User) object).userObject);
}