avoid assertion when deliberately testing for failure

This commit is contained in:
Michael Kirk 2018-11-09 18:48:58 -06:00
parent 24668fa790
commit 2c44cbccfd
2 changed files with 18 additions and 1 deletions

View File

@ -286,7 +286,9 @@ public class OWSUDManagerImpl: NSObject, OWSUDManager {
if isUDVerboseLoggingEnabled() {
Logger.info("UD disabled for \(recipientId), no profile key for this recipient.")
}
owsFailDebug("Couldn't find profile key for UD-enabled user.")
if (!CurrentAppContext().isRunningTests) {
owsFailDebug("Couldn't find profile key for UD-enabled user.")
}
return nil
}
if isUDVerboseLoggingEnabled() {

View File

@ -50,4 +50,19 @@ NS_ASSUME_NONNULL_BEGIN
#endif
#define OWSFailDebugUnlessRunningTests(_messageFormat, ...) \
do { \
if (!CurrentAppContext().isRunningTests) { \
OWSFailDebug(_messageFormat, ##__VA_ARGS__); \
} \
} while (0)
#define OWSCFailDebugUnlessRunningTests(_messageFormat, ...) \
do { \
if (!CurrentAppContext().isRunningTests) { \
OWSCFailDebug(_messageFormat, ##__VA_ARGS__); \
} \
} while (NO)
NS_ASSUME_NONNULL_END