[SERVER-14418] Introduce unittest::assertGet(StatusWith<T>) method to facilitate testing functions that return StatusWith Created: 01/Jul/14  Updated: 11/Jul/16  Resolved: 02/Jul/14

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 2.7.3

Type: Improvement Priority: Major - P3
Reporter: Andy Schwerin Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Per the summary, it is often convenient to write tests that assert both that a method returning StatusWith<T> succeeds and checks the value of the returned T. assertGet(StatusWith<T> swt) should ASSERT_OK(swt.getStatus()) and then return swt.getValue(), so that you can write:

ASSERT_EQUALS(someVal, unittest::assertGet(someStatusWithMethod())



 Comments   
Comment by Githook User [ 02/Jul/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-14418 Introduce unittest::assertGet, use in replication_executor_test.
Branch: master
https://github.com/mongodb/mongo/commit/8ad0bf94e69d09ab3bbb02e5493e69e7e392b0c3

Generated at Thu Feb 08 03:34:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.