@Test
public void testSetAllExcept() throws MapperException, SchemaException {

    LOG.info("testSetAllExcept");
    final TestMapperRegistry testMapperRegistry = new TestMapperRegistry();
    final TestEntityMapper testEntityMapper = testMapperRegistry.getMapper(TestEntityMapper.class);
    final TestEntity testEntity = new TestEntity(new Uid<>(), "field0", "field1", "field2", "field3",
            "field4");
    // One exclude.
    final MongoDBUpdate mongoDBUpdate0 = new MongoDBUpdate().setAllExcept(testEntityMapper, testEntity,
            testEntityMapper.f4);
    final BasicDBObject value0 = (BasicDBObject) mongoDBUpdate0.toDBObject().get(MongoDBUpdate.OPERATOR_SET);
    Assert.assertNotNull(value0);
    Assert.assertEquals(4, value0.size());
    // Two excludes.
    final MongoDBUpdate mongoDBUpdate1 = new MongoDBUpdate().setAllExcept(testEntityMapper, testEntity,
            testEntityMapper.f3, testEntityMapper.f4);
    final BasicDBObject value1 = (BasicDBObject) mongoDBUpdate1.toDBObject().get(MongoDBUpdate.OPERATOR_SET);
    Assert.assertNotNull(value1);
    Assert.assertEquals(3, value1.size());
    // No excludes.
    final MongoDBUpdate mongoDBUpdate2 = new MongoDBUpdate().setAllExcept(testEntityMapper, testEntity);
    final BasicDBObject value2 = (BasicDBObject) mongoDBUpdate2.toDBObject().get(MongoDBUpdate.OPERATOR_SET);
    Assert.assertNotNull(value2);
    Assert.assertEquals(5, value2.size());
    // All excludes.
    final MongoDBUpdate mongoDBUpdate3 = new MongoDBUpdate().setAllExcept(testEntityMapper, testEntity,
            testEntityMapper.f0, testEntityMapper.f1, testEntityMapper.f2, testEntityMapper.f3, testEntityMapper.f4);
    final BasicDBObject value3 = (BasicDBObject) mongoDBUpdate3.toDBObject();
    Assert.assertNotNull(value3);
    Assert.assertEquals(0, value3.size());
}