assertTrue("Result is not of type WriteResult", result instanceof WriteResult);
WriteResult wr = (WriteResult) result;
// should not be null because with WriteConcern.SAFE, getLastError was called implicitly by the driver
assertNotNull(wr.getCachedLastError());
CommandResult cr = wr.getLastError();
assertTrue(cr.ok());
// same behaviour should be reproduced with String 'SAFE'
result = template.requestBodyAndHeader("direct:noWriteConcern", "{\"scientist\":\"newton\"}", MongoDbConstants.WRITECONCERN, "SAFE");
assertTrue("Result is not of type WriteResult", result instanceof WriteResult);
wr = (WriteResult) result;