title: OCMock stub class methods of the class that is being tested
body: <pre><code>+(NSString *) classMethod:(id)someDataObject
  {
      NSString *returnStr;
  
      //do something with someDataObject and set returnStr
      //...    
  
      returnStr = [NSString stringWithFormat:@"%@%@", returnStr,[self getCurrentTimestamp]];
  
      return returnStr;
  }
  
  + (NSString *)getCurrentTimestamp
  {
      NSNumber *t = [NSNumber numberWithLong:[[NSDate date] timeIntervalSince1970]];
      return [t stringValue];
  }
  </code></pre>
  
  <p>I am struggling to write test case for the classMethod because when I run OCUnit test and pass OCMock object to classMethod the output will be always different as I add timestamp. What is the best approach to <em>stub</em> class method - getCurrentTimestamp? Is it actually possible to stub class methods of the class that is being tested? </p>
  
  <p>I tried like this, but it is not working:</p>
  
  <pre><code> id mock =  [OCMockObject mockForClass:[MyClass class]];
   [[[mock stub] andReturn:@1378468455] getCurrentTimestamp];
  
   NSString *str = [MyClass classMethod:someMockObject];
  </code></pre>