-
Notifications
You must be signed in to change notification settings - Fork 609
Expand file tree
/
Copy pathOCMockObjectMacroTests.m
More file actions
641 lines (484 loc) · 20 KB
/
OCMockObjectMacroTests.m
File metadata and controls
641 lines (484 loc) · 20 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
/*
* Copyright (c) 2014-2020 Erik Doernenburg and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use these files except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
#import <XCTest/XCTest.h>
#import "OCMock.h"
@protocol TestProtocolForMacroTesting
- (NSString *)stringValue;
@end
@interface TestClassForMacroTesting : NSObject<TestProtocolForMacroTesting>
@end
@implementation TestClassForMacroTesting
- (NSString *)stringValue
{
return @"FOO";
}
@end
@interface TestClassWithDecimalReturnMethod : NSObject
- (NSDecimalNumber *)method;
@end
@implementation TestClassWithDecimalReturnMethod
- (NSDecimalNumber *)method
{
return nil;
}
@end
@interface TestClassWithClassReturnMethod : NSObject
- (Class)method;
@end
@implementation TestClassWithClassReturnMethod
- (Class)method
{
return [self class];
}
@end
// implemented in OCMockObjectClassMethodMockingTests
@interface TestClassWithClassMethods : NSObject
+ (NSString *)foo;
+ (NSString *)bar;
- (NSString *)bar;
@end
@interface OCMockObjectMacroTests : XCTestCase
{
BOOL shouldCaptureFailure;
NSString *reportedDescription;
NSString *reportedFile;
NSInteger reportedLine;
}
@end
@implementation OCMockObjectMacroTests
#ifdef __IPHONE_14_0 // this is actually a test for Xcode 12; see issue #472
- (void)recordIssue:(XCTIssue *)issue
{
if(shouldCaptureFailure)
{
reportedDescription = issue.compactDescription;
reportedFile = issue.sourceCodeContext.location.fileURL.path;
reportedLine = issue.sourceCodeContext.location.lineNumber;
}
else
{
[super recordIssue:issue];
}
}
#else
- (void)recordFailureWithDescription:(NSString *)description inFile:(NSString *)file atLine:(NSUInteger)line expected:(BOOL)expected
{
if(shouldCaptureFailure)
{
reportedDescription = description;
reportedFile = file;
reportedLine = line;
}
else
{
[super recordFailureWithDescription:description inFile:file atLine:line expected:expected];
}
}
#endif
- (void)testReportsVerifyFailureWithCorrectLocation
{
id mock = OCMClassMock([NSString class]);
[[mock expect] lowercaseString];
shouldCaptureFailure = YES;
OCMVerifyAll(mock); const char *expectedFile = __FILE__; int expectedLine = __LINE__;
shouldCaptureFailure = NO;
XCTAssertNotNil(reportedDescription, @"Should have recorded a failure with description.");
XCTAssertEqualObjects([NSString stringWithUTF8String:expectedFile], reportedFile, @"Should have reported correct file.");
XCTAssertEqual(expectedLine, (int)reportedLine, @"Should have reported correct line");
}
- (void)testReportsIgnoredExceptionsAtVerifyLocation
{
id mock = OCMClassMock([NSString class]);
[[mock reject] lowercaseString];
@try
{
[mock lowercaseString];
}
@catch(NSException *exception)
{
// ignore; the mock will rethrow this in verify
}
shouldCaptureFailure = YES;
OCMVerifyAll(mock); const char *expectedFile = __FILE__; int expectedLine = __LINE__;
shouldCaptureFailure = NO;
XCTAssertTrue([reportedDescription rangeOfString:@"ignored"].location != NSNotFound, @"Should have reported ignored exceptions.");
XCTAssertEqualObjects([NSString stringWithUTF8String:expectedFile], reportedFile, @"Should have reported correct file.");
XCTAssertEqual(expectedLine, (int)reportedLine, @"Should have reported correct line");
}
- (void)testReportsVerifyWithDelayFailureWithCorrectLocation
{
id mock = OCMClassMock([NSString class]);
[[mock expect] lowercaseString];
shouldCaptureFailure = YES;
OCMVerifyAllWithDelay(mock, 0.05); const char *expectedFile = __FILE__; int expectedLine = __LINE__;
shouldCaptureFailure = NO;
XCTAssertNotNil(reportedDescription, @"Should have recorded a failure with description.");
XCTAssertEqualObjects([NSString stringWithUTF8String:expectedFile], reportedFile, @"Should have reported correct file.");
XCTAssertEqual(expectedLine, (int)reportedLine, @"Should have reported correct line");
}
- (void)testSetsUpStubsForCorrectMethods
{
id mock = OCMStrictClassMock([NSString class]);
OCMStub([mock uppercaseString]).andReturn(@"TEST_STRING");
XCTAssertEqualObjects(@"TEST_STRING", [mock uppercaseString], @"Should have returned stubbed value");
XCTAssertThrows([mock lowercaseString]);
}
- (void)testSetsUpStubsWithNonObjectReturnValues
{
id mock = OCMStrictClassMock([NSString class]);
OCMStub([mock boolValue]).andReturn(YES);
XCTAssertEqual(YES, [mock boolValue], @"Should have returned stubbed value");
}
- (void)testSetsUpStubsWithStructureReturnValues
{
id mock = OCMStrictClassMock([NSString class]);
NSRange expected = NSMakeRange(123, 456);
OCMStub([mock rangeOfString:[OCMArg any]]).andReturn(expected);
NSRange actual = [mock rangeOfString:@"substring"];
XCTAssertEqual((NSUInteger)123, actual.location, @"Should have returned stubbed value");
XCTAssertEqual((NSUInteger)456, actual.length, @"Should have returned stubbed value");
}
- (void)testSetsUpStubReturningNilForIdReturnType
{
id mock = OCMPartialMock([NSArray arrayWithObject:@"Foo"]);
OCMStub([mock lastObject]).andReturn(nil);
XCTAssertNil([mock lastObject], @"Should have returned stubbed value");
}
- (void)testSetsUpStubReturningNilForClassReturnType
{
id mock = OCMPartialMock([[TestClassWithClassReturnMethod alloc] init]);
OCMStub([mock method]).andReturn(Nil);
XCTAssertNil([mock method], @"Should have returned stubbed value");
// sometimes nil is used where Nil should be used
OCMStub([mock method]).andReturn(nil);
XCTAssertNil([mock method], @"Should have returned stubbed value");
}
- (void)testSetsUpExceptionThrowing
{
id mock = OCMClassMock([NSString class]);
OCMStub([mock uppercaseString]).andThrow([NSException exceptionWithName:@"TestException" reason:@"Testing" userInfo:nil]);
XCTAssertThrowsSpecificNamed([mock uppercaseString], NSException, @"TestException", @"Should have thrown correct exception");
}
- (void)testSetsUpNotificationPostingAndNotificationObserving
{
id mock = OCMProtocolMock(@protocol(TestProtocolForMacroTesting));
NSNotification *n = [NSNotification notificationWithName:@"TestNotification" object:nil];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
id observer = OCMObserverMock();
#pragma clang diagnostic pop
[[NSNotificationCenter defaultCenter] addMockObserver:observer name:[n name] object:nil];
OCMExpect([observer notificationWithName:[n name] object:[OCMArg any]]);
OCMStub([mock stringValue]).andPost(n);
[mock stringValue];
OCMVerifyAll(observer);
}
- (void)testNotificationObservingWithUserInfo
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
id observer = OCMObserverMock();
#pragma clang diagnostic pop
[[NSNotificationCenter defaultCenter] addMockObserver:observer name:@"TestNotificationWithInfo" object:nil];
OCMExpect([observer notificationWithName:@"TestNotificationWithInfo" object:[OCMArg any] userInfo:[OCMArg any]]);
[[NSNotificationCenter defaultCenter] postNotificationName:@"TestNotificationWithInfo" object:self userInfo:@{ @"foo" : @"bar" }];
OCMVerifyAll(observer);
}
- (void)testSetsUpSubstituteCall
{
id mock = OCMStrictProtocolMock(@protocol(TestProtocolForMacroTesting));
OCMStub([mock stringValue]).andCall(self, @selector(stringValueForTesting));
XCTAssertEqualObjects([mock stringValue], @"TEST_STRING_FROM_TESTCASE", @"Should have called method from test case");
}
- (NSString *)stringValueForTesting
{
return @"TEST_STRING_FROM_TESTCASE";
}
- (void)testFulfillsExpectation
{
id mock = OCMStrictClassMock([NSString class]);
OCMStub([mock boolValue]).andFulfill([self expectationWithDescription:@"Expectation Called"]).andReturn(YES);
XCTAssertTrue([mock boolValue]);
[self waitForExpectationsWithTimeout:0 handler:nil];
}
- (void)testCanChainPropertyBasedActions
{
id mock = OCMPartialMock([[TestClassForMacroTesting alloc] init]);
__block BOOL didCallBlock = NO;
void (^theBlock)(NSInvocation *) = ^(NSInvocation *invocation) {
didCallBlock = YES;
};
OCMStub([mock stringValue]).andDo(theBlock).andForwardToRealObject();
NSString *actual = [mock stringValue];
XCTAssertTrue(didCallBlock, @"Should have called block");
XCTAssertEqualObjects(@"FOO", actual, @"Should have forwarded invocation");
}
- (void)testCanUseVariablesInInvocationSpec
{
id mock = OCMStrictClassMock([NSString class]);
NSString *expected = @"foo";
OCMStub([mock rangeOfString:expected]).andReturn(NSMakeRange(0, 3));
XCTAssertThrows([mock rangeOfString:@"bar"], @"Should not have accepted invocation with non-matching arg.");
}
- (void)testSetsUpExpectations
{
id mock = OCMClassMock([TestClassForMacroTesting class]);
OCMExpect([mock stringValue]).andReturn(@"TEST_STRING");
XCTAssertThrows([mock verify], @"Should have complained about expected method not being invoked");
XCTAssertEqual([mock stringValue], @"TEST_STRING", @"Should have stubbed method, too");
XCTAssertNoThrow([mock verify], @"Should have accepted invocation as matching expectation");
}
- (void)testSetsUpReject
{
id mock = OCMClassMock([TestClassForMacroTesting class]);
OCMReject([mock stringValue]);
XCTAssertNoThrow([mock verify], @"Should have accepted invocation rejected method not being invoked");
XCTAssertThrows([mock stringValue], @"Should have complained during rejected method being invoked");
XCTAssertThrows([mock verify], @"Should have complained about rejected method being invoked");
}
- (void)testThrowsWhenTryingToAddActionToReject
{
id mock = OCMClassMock([TestClassForMacroTesting class]);
XCTAssertThrows(OCMReject([mock stringValue]).andReturn(@"Foo"));
}
- (void)testShouldNotReportErrorWhenMethodWasInvoked
{
id mock = OCMClassMock([NSString class]);
[mock lowercaseString];
shouldCaptureFailure = YES;
OCMVerify([mock lowercaseString]);
shouldCaptureFailure = NO;
XCTAssertNil(reportedDescription, @"Should not have recorded a failure.");
}
- (void)testShouldReportErrorWhenMethodWasNotInvoked
{
id mock = OCMClassMock([NSString class]);
[mock lowercaseString];
shouldCaptureFailure = YES;
OCMVerify([mock uppercaseString]); const char *expectedFile = __FILE__; int expectedLine = __LINE__;
shouldCaptureFailure = NO;
XCTAssertNotNil(reportedDescription, @"Should have recorded a failure with description.");
XCTAssertEqualObjects([NSString stringWithUTF8String:expectedFile], reportedFile, @"Should have reported correct file.");
XCTAssertEqual(expectedLine, (int)reportedLine, @"Should have reported correct line");
}
- (void)testShouldThrowDescriptiveExceptionWhenTryingToVerifyUnimplementedMethod
{
id mock = OCMClassMock([NSString class]);
// have not found a way to report the error; it seems we must throw an
// exception to get out of the forwarding machinery
XCTAssertThrowsSpecificNamed(OCMVerify([mock arrayByAddingObject:@"foo"]),
NSException, NSInvalidArgumentException, @"should throw NSInvalidArgumentException exception");
}
- (void)testShouldThrowExceptionWhenNotUsingMockInMacroThatRequiresMock
{
id realObject = [NSMutableArray array];
XCTAssertThrowsSpecificNamed(OCMStub([realObject addObject:@"foo"]), NSException, NSInternalInconsistencyException);
XCTAssertThrowsSpecificNamed(OCMExpect([realObject addObject:@"foo"]), NSException, NSInternalInconsistencyException);
XCTAssertThrowsSpecificNamed(OCMReject([realObject addObject:@"foo"]), NSException, NSInternalInconsistencyException);
XCTAssertThrowsSpecificNamed(OCMVerify([realObject addObject:@"foo"]), NSException, NSInternalInconsistencyException);
}
- (void)testShouldHintAtPossibleReasonWhenNotUsingMockInMacroThatRequiresMock
{
@try
{
id realObject = [NSMutableArray array];
OCMStub([realObject addObject:@"foo"]);
}
@catch(NSException *e)
{
XCTAssertTrue([[e reason] containsString:@"The receiver is not a mock object."]);
}
}
- (void)testShouldThrowExceptionWhenMockingMethodThatCannotBeMocked
{
id mock = OCMClassMock([NSString class]);
XCTAssertThrowsSpecificNamed(OCMStub([mock description]), NSException, NSInternalInconsistencyException);
XCTAssertThrowsSpecificNamed(OCMExpect([mock description]), NSException, NSInternalInconsistencyException);
XCTAssertThrowsSpecificNamed(OCMReject([mock description]), NSException, NSInternalInconsistencyException);
XCTAssertThrowsSpecificNamed(OCMVerify([mock description]), NSException, NSInternalInconsistencyException);
}
- (void)testShouldHintAtPossibleReasonWhenMockingMethodThatCannotBeMocked
{
@try
{
id mock = OCMClassMock([NSString class]);
OCMStub([mock description]);
}
@catch(NSException *e)
{
XCTAssertTrue([[e reason] containsString:@"The selector conflicts with a selector implemented by OCMStubRecorder/OCMExpectationRecorder."]);
}
}
- (void)testShouldHintAtPossibleReasonWhenVerifyingMethodThatCannotBeMocked
{
@try
{
id mock = OCMClassMock([NSString class]);
OCMVerify([mock description]);
}
@catch(NSException *e)
{
XCTAssertTrue([[e reason] containsString:@"The selector conflicts with a selector implemented by OCMVerifier."]);
}
}
- (void)testShouldThrowExceptionWhenInvocationsOccurAfterMockRecorded
{
@try
{
id mock = OCMClassMock([NSUUID class]);
OCMExpect([mock UUID]).andReturn(mock);
// Exception should be thrown on this line because we don't want to record [mock UUID],
// we want to record UUIDString.
OCMExpect([[mock UUID] UUIDString]).andReturn(@"Hello");
[NSUUID UUID];
[NSUUID UUID];
OCMVerifyAll(mock);
XCTFail(@"Should never be reached");
}
@catch(NSException *e)
{
XCTAssertTrue([[e reason] containsString:@"but recorder has already recorded a stub for"],
@"Caught Exception: `%@`", [e reason]);
}
}
- (void)testCanExplicitlySelectClassMethodForStubs
{
id mock = OCMClassMock([TestClassWithClassMethods class]);
OCMStub(ClassMethod([mock bar])).andReturn(@"mocked-class");
OCMStub([mock bar]).andReturn(@"mocked-instance");
XCTAssertEqualObjects(@"mocked-class", [TestClassWithClassMethods bar], @"Should have stubbed class method.");
XCTAssertEqualObjects(@"mocked-instance", [mock bar], @"Should have stubbed instance method.");
}
- (void)testSelectsInstanceMethodForStubsWhenAmbiguous
{
id mock = OCMClassMock([TestClassWithClassMethods class]);
OCMStub([mock bar]).andReturn(@"mocked-instance");
XCTAssertEqualObjects(@"mocked-instance", [mock bar], @"Should have stubbed instance method.");
}
- (void)testSelectsClassMethodForStubsWhenUnambiguous
{
id mock = OCMClassMock([TestClassWithClassMethods class]);
OCMStub([mock foo]).andReturn(@"mocked-class");
XCTAssertEqualObjects(@"mocked-class", [TestClassWithClassMethods foo], @"Should have stubbed class method.");
}
- (void)testCanExplicitlySelectClassMethodForVerify
{
id mock = OCMClassMock([TestClassWithClassMethods class]);
[TestClassWithClassMethods bar];
OCMVerify(ClassMethod([mock bar]));
}
- (void)testSelectsInstanceMethodForVerifyWhenAmbiguous
{
id mock = OCMClassMock([TestClassWithClassMethods class]);
[mock bar];
OCMVerify([mock bar]);
}
- (void)testSelectsClassMethodForVerifyWhenUnambiguous
{
id mock = OCMClassMock([TestClassWithClassMethods class]);
[TestClassWithClassMethods foo];
OCMVerify([mock foo]);
}
- (void)testCanUseMacroToStubMethodWithDecimalReturnValue
{
id mock = OCMClassMock([TestClassWithDecimalReturnMethod class]);
OCMStub([mock method]).andReturn([NSDecimalNumber decimalNumberWithDecimal:[@0 decimalValue]]);
XCTAssertEqualObjects([mock method], [NSDecimalNumber decimalNumberWithDecimal:[@0 decimalValue]]);
}
- (void)testCanUseMacroToStubMethodWithAnyNonObjectArgument
{
id mock = OCMStrictClassMock([NSString class]);
OCMStub([mock commonPrefixWithString:@"foo" options:0]).ignoringNonObjectArgs();
XCTAssertNoThrow([mock commonPrefixWithString:@"foo" options:NSCaseInsensitiveSearch]);
}
- (void)testCanUseMacroToStubMethodWithAnyNonObjectArgumentChainedWithOCMStubRecorder
{
id mock = OCMClassMock([NSString class]);
OCMStub([mock commonPrefixWithString:@"foo" options:0]).ignoringNonObjectArgs().andReturn(@"f");
XCTAssertEqualObjects(@"f", [mock commonPrefixWithString:@"foo" options:NSCaseInsensitiveSearch]);
}
- (void)testReturnsCorrectObjectFromInitMethodCalledOnRecorderInsideMacro
{
// Because of the way the macros work, you can call recorder methods on the mock and they will
// work correctly. Technically these are a mix of old syntax and new.
//
// There are no assertions here, the tests will crash with an incorrect implementation.
//
// Note that the andReturn:nil has to be first because this is the stub that will actually be
// used and we're now making sure that a return value is specified for init methods.
id mock = OCMClassMock([NSString class]);
OCMStub([[mock andReturn:nil] initWithString:OCMOCK_ANY]);
OCMStub([[mock ignoringNonObjectArgs] initWithString:OCMOCK_ANY]);
OCMStub([[mock andReturnValue:nil] initWithString:OCMOCK_ANY]);
OCMStub([[mock andThrow:nil] initWithString:OCMOCK_ANY]);
OCMStub([[mock andPost:nil] initWithString:OCMOCK_ANY]);
OCMStub([[mock andCall:nil onObject:nil] initWithString:OCMOCK_ANY]);
OCMStub([[mock andFulfill:nil] initWithString:OCMOCK_ANY]);
OCMStub([[mock andDo:nil] initWithString:OCMOCK_ANY]);
OCMStub([[mock andForwardToRealObject] initWithString:OCMOCK_ANY]);
OCMExpect([[mock never] initWithString:OCMOCK_ANY]);
__unused id value = [mock initWithString:@"hello"];
_OCMVerify([(id)[mock withQuantifier:nil] initWithString:OCMOCK_ANY]);
// Test multiple levels of recorder methods.
OCMStub([[[[mock ignoringNonObjectArgs] andReturn:nil] andThrow:nil] initWithString:OCMOCK_ANY]);
}
- (void)testStubMacroPassesExceptionThrough
{
id mock = OCMClassMock([TestClassForMacroTesting class]);
@try
{
OCMStub([mock init]).andReturn(mock);
XCTFail(@"An exception should have been thrown.");
}
@catch(NSException *exception)
{
XCTAssertEqualObjects(exception.name, NSInternalInconsistencyException);
XCTAssertTrue([exception.reason containsString:@"Method init invoked twice on stub recorder"]);
}
}
- (void)testExpectMacroPassesExceptionThrough
{
id mock = OCMClassMock([TestClassForMacroTesting class]);
@try
{
OCMExpect([mock init]).andReturn(mock);
XCTFail(@"An exception should have been thrown.");
}
@catch(NSException *exception)
{
XCTAssertEqualObjects(exception.name, NSInternalInconsistencyException);
XCTAssertTrue([exception.reason containsString:@"Method init invoked twice on stub recorder"]);
}
}
- (void)testVerifyMacroPassExceptionsThrough
{
id mock = OCMClassMock([TestClassForMacroTesting class]);
@try
{
// The -Wunused-value is a workaround for https://bugs.llvm.org/show_bug.cgi?id=45245
_Pragma("clang diagnostic push")
_Pragma("clang diagnostic ignored \"-Wunused-value\"")
OCMVerify([mock init]);
_Pragma("clang diagnostic pop")
XCTFail(@"An exception should have been thrown.");
}
@catch(NSException *exception)
{
XCTAssertEqualObjects(exception.name, NSInternalInconsistencyException);
XCTAssertTrue([exception.reason containsString:@"Method init invoked twice on verifier"]);
}
}
@end