lundi 7 décembre 2015

OCMock version 3 will not recognized class methods

I am trying to use OCMock version 3 on class methods. These methods are not recognized. Does anyone know why and how do I solve this. When I am typing the code for the stub the maskWithObjectType method does not appear. I enter it anyway and try the test. Some code is

#import <Foundation/Foundation.h>
@interface ObjectMask : NSObject
@property (strong, nonatomic, readonly) Class objectType;
@property (strong, nonatomic, readonly) NSMutableArray* requestedFields;
@property (strong, nonatomic, readonly) NSDictionary* children;
@property (weak, nonatomic, readonly) ObjectMask* parent;
#pragma mark - Factory
+(instancetype)maskWithObjectType:(Class)objectType;

The mocking is

id mockMask = OCMClassMock([ObjectMask class]);
OCMStub([mockMask maskWithObjectType:[someotherclass class]]);
[mockMask maskWithObjectType:[someotherclass class]];
OCMVerify(mockMask);

When I run the test I get the error

failed: caught "NSInvalidArgumentException", "-[OCMockObject(PGWS3ObjectMask) maskWithObjectType:]: unrecognized selector sent to instance 0x7fe420e0ca60"

Aucun commentaire:

Enregistrer un commentaire