Skip to content

Commit

Permalink
Add test coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper Blues committed Feb 10, 2013
1 parent 12286da commit 67d86d0
Show file tree
Hide file tree
Showing 28 changed files with 1,119 additions and 29 deletions.
1 change: 0 additions & 1 deletion External/OCMockito.framework/Headers

This file was deleted.

17 changes: 17 additions & 0 deletions External/OCMockito.framework/Headers/MKTBaseMockObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// OCMockito - MKTBaseMockObject.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//

#import <Foundation/Foundation.h>
#import "MKTPrimitiveArgumentMatching.h"


@interface MKTBaseMockObject : NSProxy <MKTPrimitiveArgumentMatching>

- (id)init;

@end
22 changes: 22 additions & 0 deletions External/OCMockito.framework/Headers/MKTClassObjectMock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// OCMockito - MKTClassObjectMock.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//
// Created by: David Hart
//

#import "MKTBaseMockObject.h"


/**
Mock object of a given class object.
*/
@interface MKTClassObjectMock : MKTBaseMockObject

+ (id)mockForClass:(Class)aClass;
- (id)initWithClass:(Class)aClass;

@end
20 changes: 20 additions & 0 deletions External/OCMockito.framework/Headers/MKTObjectAndProtocolMock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// OCMockito - MKTObjectAndProtocolMock.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Kevin Lundberg
// Source: https://github.com/jonreid/OCMockito
//

#import "MKTProtocolMock.h"


/**
Mock object of a given class that also implements a given protocol.
*/
@interface MKTObjectAndProtocolMock : MKTProtocolMock

+ (id)mockForClass:(Class)aClass protocol:(Protocol *)protocol;
- (id)initWithClass:(Class)aClass protocol:(Protocol *)protocol;

@end
20 changes: 20 additions & 0 deletions External/OCMockito.framework/Headers/MKTObjectMock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// OCMockito - MKTObjectMock.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//

#import "MKTBaseMockObject.h"


/**
Mock object of a given class.
*/
@interface MKTObjectMock : MKTBaseMockObject

+ (id)mockForClass:(Class)aClass;
- (id)initWithClass:(Class)aClass;

@end
70 changes: 70 additions & 0 deletions External/OCMockito.framework/Headers/MKTOngoingStubbing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// OCMockito - MKTOngoingStubbing.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//

#import <Foundation/Foundation.h>
#import "MKTPrimitiveArgumentMatching.h"

@class MKTInvocationContainer;


/**
Methods to invoke on @c given(methodCall) to return stubbed values.
*/
@interface MKTOngoingStubbing : NSObject <MKTPrimitiveArgumentMatching>

- (id)initWithInvocationContainer:(MKTInvocationContainer *)invocationContainer;

/// Stubs given object as return value.
- (MKTOngoingStubbing *)willReturn:(id)object;

/// Stubs given @c BOOL as return value.
- (MKTOngoingStubbing *)willReturnBool:(BOOL)value;

/// Stubs given @c char as return value.
- (MKTOngoingStubbing *)willReturnChar:(char)value;

/// Stubs given @c int as return value.
- (MKTOngoingStubbing *)willReturnInt:(int)value;

/// Stubs given @c short as return value.
- (MKTOngoingStubbing *)willReturnShort:(short)value;

/// Stubs given @c long as return value.
- (MKTOngoingStubbing *)willReturnLong:(long)value;

/// Stubs given <code>long long</code> as return value.
- (MKTOngoingStubbing *)willReturnLongLong:(long long)value;

/// Stubs given @c NSInteger as return value.
- (MKTOngoingStubbing *)willReturnInteger:(NSInteger)value;

/// Stubs given <code>unsigned char</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedChar:(unsigned char)value;

/// Stubs given <code>unsigned int</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedInt:(unsigned int)value;

/// Stubs given <code>unsigned short</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedShort:(unsigned short)value;

/// Stubs given <code>unsigned long</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedLong:(unsigned long)value;

/// Stubs given <code>unsigned long long</code> as return value.
- (MKTOngoingStubbing *)willReturnUnsignedLongLong:(unsigned long long)value;

/// Stubs given @c NSUInteger as return value.
- (MKTOngoingStubbing *)willReturnUnsignedInteger:(NSUInteger)value;

/// Stubs given @c float as return value.
- (MKTOngoingStubbing *)willReturnFloat:(float)value;

/// Stubs given @c double as return value.
- (MKTOngoingStubbing *)willReturnDouble:(double)value;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// OCMockito - MKTPrimitiveArgumentMatching.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//

@protocol HCMatcher;


/**
Ability to specify OCHamcrest matchers for primitive numeric arguments.
*/
@protocol MKTPrimitiveArgumentMatching

/**
Specifies OCHamcrest matcher for a specific argument of a method.
For methods arguments that take objects, just pass the matcher directly as a method call. But
for arguments that take primitive numeric types, call this to specify the matcher before passing
in a dummy value. Upon verification, the actual numeric argument received will be converted to
an NSNumber before being checked by the matcher.
The argument index is 0-based, so the first argument of a method has index 0.
Example:
@code
[[verify(mockArray) withMatcher:greaterThan([NSNumber numberWithInt:1]) forArgument:0]
removeObjectAtIndex:0];
@endcode
This verifies that @c removeObjectAtIndex: was called with a number greater than 1.
*/
- (id)withMatcher:(id <HCMatcher>)matcher forArgument:(NSUInteger)index;

/**
Specifies OCHamcrest matcher for the first argument of a method.
Equivalent to <code>withMatcher:matcher forArgument:0</code>.
Example:
@code
[[verify(mockArray) withMatcher:greaterThan([NSNumber numberWithInt:1]) forArgument:0]
removeObjectAtIndex:0];
@endcode
This verifies that @c removeObjectAtIndex: was called with a number greater than 1.
*/
- (id)withMatcher:(id <HCMatcher>)matcher;

@end
20 changes: 20 additions & 0 deletions External/OCMockito.framework/Headers/MKTProtocolMock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// OCMockito - MKTProtocolMock.h
// Copyright 2012 Jonathan M. Reid. See LICENSE.txt
//
// Created by: Jon Reid, http://qualitycoding.org/
// Source: https://github.com/jonreid/OCMockito
//

#import "MKTBaseMockObject.h"


/**
Mock object implementing a given protocol.
*/
@interface MKTProtocolMock : MKTBaseMockObject

+ (id)mockForProtocol:(Protocol *)aProtocol;
- (id)initWithProtocol:(Protocol *)aProtocol;

@end
Loading

0 comments on commit 67d86d0

Please sign in to comment.