ocmock Questions
3
I've got an app where I push a UIAlertController with several custom UIAlertActions. Each UIAlertAction performs unique tasks in the handler block of actionWithTitle:style:handler:.
I have several...
3
Solved
i'm a new user of OCMock, so maybe i'm just missing something simple here. this code does not compile:
id mockSession = [OCMockObject mockForClass:[AVCaptureSession class]];
[[mockSession expect] ...
Johnsiejohnson asked 25/1, 2013 at 19:14
24
Solved
I have started working with OCMock to write test cases for the existing project that I have integrated in my project workspace. After following all the steps mentioned in this link.
When I first e...
Deficit asked 25/1, 2016 at 10:23
6
Solved
I'm learning how to use OCMock to test my iPhone's project and I have this scenario: a HeightMap class with a getHeightAtX:andY: method, and a Render class using HeightMap. I'm trying to unit test ...
3
Solved
Is there a way to verify that a method has been called 'x' amount of times?
Cordula asked 25/3, 2011 at 15:33
6
Solved
At my day job I've been spoiled with Mockito's never() verification, which can confirm that a mock method is never called.
Is there some way to accomplish the same thing using Objective-C and OCMo...
Tall asked 29/4, 2010 at 16:43
3
Solved
I am trying to write an block of code using OCMock's stub andDo method.
In this case UIImageView extension class is being tested. I want to check that the extension calls [self setImage:] with par...
3
is there any way to invoke a block with nil as a given argument, given that the invokeBlockWithArgs: requires the args to be nil-terminated?
example method definition in a mocked object:
- (void)...
Shabuoth asked 2/8, 2016 at 21:59
1
Solved
I am trying to write a test case for a method in Objective-C class which returns void. The method mobileTest just creates another object of class AnotherClass and calls a method makeNoise. How to t...
Solubilize asked 22/12, 2016 at 3:41
3
Solved
I'm using OCMock 1.70 and am having a problem mocking a simple method that returns a BOOL value. Here's my code:
@interface MyClass : NSObject
- (void)methodWithArg:(id)arg;
- (BOOL)methodWithBOOL...
Pervade asked 5/12, 2010 at 2:55
5
Solved
Assume a method signature such as the following:
- (void)theMethod:(void(^)(BOOL completed))completionBlock;
I would like to mock this method signature to ensure the method is called, and just c...
Johannesburg asked 13/5, 2013 at 20:2
1
OCMock offers a nice syntax to mock class methods, but can class method calls be forwarded to the real class object?
self.connectionMock = [OCMockObject mockForClass:NSURLConnection.class];
[[[[s...
Macdougall asked 25/10, 2013 at 0:10
6
I am using OCMock 3 to unit test my iOS project.
I use dispatch_once() created a singleton class MyManager :
@implementation MyManager
+ (id)sharedInstance {
static MyManager *sharedMyManager ...
Dicker asked 31/5, 2016 at 15:20
1
My function under test is very simple:
@implementation MyHandler
...
-(void) processData {
DataService *service = [[DataService alloc] init];
NSDictionary *data = [service getData];
[self handl...
Interfluve asked 6/6, 2016 at 9:45
2
I'm using OCMock for creating mocks in my tests for my iOS app, and I'd like to create mocks of protocols that don't implement all of the optional methods.
If it's not clear what I mean... here's ...
Shanley asked 12/8, 2012 at 16:46
3
Solved
How do I verify a method is never called with OCMock 3?
I was thinking something like this:
XCTAssertThrows(OCMVerify([_restDataSource getSomeStuff:[OCMArg any]]));
But it seems like OCMVerify ...
Upbraiding asked 25/2, 2015 at 22:55
1
I have a networking class called: ITunesAlbumDataDownloader
@implementation AlbumDataDownloader
- (void)downloadDataWithURLString:(NSString *)urlString
completionHandler:(void (^)(NSArray *, NSE...
Electrophoresis asked 26/11, 2015 at 4:24
4
Solved
It seems that the first time I add andReturnValue on an OCMock stub, that return value is set in stone. For example:
id physics = [OCMockObject niceMockForClass:[DynamicPhysicsComponent class]
Ent...
Realgar asked 14/4, 2011 at 4:22
3
Solved
I would like to accomplish what also is described here, i.e create mocks inside legacy code. However I require partial instead of nice or strict mocks.
For example, consider leaderboards that beha...
Cyclist asked 30/1, 2015 at 16:59
1
Solved
For iOS tdd testing/mocking which framework would you recommend? I heard that OcMock has been around longer and is more lightweight. Could anyone provide a few examples of the pros and cons or demo...
2
I am trying to unit test a method which uses NSFileManager to check if a file exists and delete the file. I'm not sure I am correctly setting up the mock object.
I'm getting "Method was not invoke...
Beaubeauchamp asked 25/3, 2015 at 16:52
1
Solved
I'm using since recently OCMock for my unit testing. I need to stub the
objectForInfoDictionaryKey: method from NSBundle. I've done the following :
self.bundleMock = OCMClassMock([NSBundle class]...
Creepie asked 13/4, 2015 at 15:58
1
Solved
I have some code that calls [NSBundle mainBundle] at some point, mainly to read/set preferences. When I unit test the method, the test fails because the test's mainBundle does not contain the file....
Proptosis asked 11/3, 2015 at 17:36
2
Solved
I Have an iOS application that I am trying to add OCMock to in order to better unit test it. I've followed the instruction on ocmock.org as well as instructions I've found in other places but still...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.