unit testing failures in Swift 2

I have some unit tests that check that saving a managed object subclass with missing required properties fail appropriately. In Swift 1.2, I could do that as follows:


XCTAssertFalse(context.save())


What is the appropriate way to test the same thing in Swift 2? This works:


do {
     try context.save()
} catch {
     XCTAssertTrue(true) // or something similar
}


but there must be a better way.

If the save is supposed to fail with an error, you probably want something more like:

do
{
    try context.save()
    XCTFail("error: invalid context was saved successfully")
}
catch {}    // test succeeded, an error occured
unit testing failures in Swift 2
 
 
Q