Skip to content

Commit 5b575fd

Browse files
committed
Merge branch 'dmaclach-noAsserts'
2 parents 7945e29 + 993508d commit 5b575fd

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

Source/OCMock/OCClassMockObject.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ @implementation OCClassMockObject
2727

2828
- (id)initWithClass:(Class)aClass
2929
{
30-
NSParameterAssert(aClass != nil);
30+
if(aClass == Nil)
31+
[NSException raise:NSInvalidArgumentException format:@"Class cannot be Nil."];
32+
3133
[super init];
3234
mockedClass = aClass;
3335
[self prepareClassForClassMethodMocking];

Source/OCMock/OCMMacroState.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ - (id)initWithRecorder:(OCMRecorder *)aRecorder
140140
- (void)dealloc
141141
{
142142
[recorder release];
143-
NSAssert([NSThread currentThread].threadDictionary[OCMGlobalStateKey] != self, @"Unexpected dealloc while set as the global state");
143+
if([NSThread currentThread].threadDictionary[OCMGlobalStateKey] == self)
144+
[NSException raise:NSInternalInconsistencyException format:@"Unexpected dealloc while set as the global state"];
144145
[super dealloc];
145146
}
146147

Source/OCMock/OCPartialMockObject.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ @implementation OCPartialMockObject
3030

3131
- (id)initWithObject:(NSObject *)anObject
3232
{
33-
NSParameterAssert(anObject != nil);
33+
if(anObject == nil)
34+
[NSException raise:NSInvalidArgumentException format:@"Object cannot be nil."];
35+
3436
Class const class = [self classToSubclassForObject:anObject];
3537
[self assertClassIsSupported:class];
3638
[super initWithClass:class];

Source/OCMock/OCProtocolMockObject.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ @implementation OCProtocolMockObject
2424

2525
- (id)initWithProtocol:(Protocol *)aProtocol
2626
{
27-
NSParameterAssert(aProtocol != nil);
27+
if(aProtocol == nil)
28+
[NSException raise:NSInvalidArgumentException format:@"Protocol cannot be nil."];
29+
2830
[super init];
2931
mockedProtocol = aProtocol;
3032
return self;

0 commit comments

Comments
 (0)