keeganwitt / gmock

Automatically exported from code.google.com/p/gmock
6 stars 2 forks source link

Move internal classes to internal package #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Move all the classes(except Mock and GMockTestCase) to some internal 
package(like "org.gmock.internal").

Original issue reported on code.google.com by JohnnyJianHY on 1 Oct 2008 at 3:34

GoogleCodeExporter commented 9 years ago
Fix in next release.

Original comment by JohnnyJianHY on 11 Oct 2008 at 3:20

GoogleCodeExporter commented 9 years ago
Leave the GMockController class external.
But, should the Mock class be external? That is, will users use it directly?

Original comment by JohnnyJianHY on 11 Oct 2008 at 3:23

GoogleCodeExporter commented 9 years ago

Original comment by JohnnyJianHY on 12 Oct 2008 at 12:26

GoogleCodeExporter commented 9 years ago
Mock shouldn't theoretically accessed directly. If they were people would also 
have
to had them to the mocks list in the GMockController.

I had to use it directly in order to bypass the closure mocking lack. 

Original comment by julien.g...@gmail.com on 12 Oct 2008 at 1:42

GoogleCodeExporter commented 9 years ago
"I had to use it directly in order to bypass the closure mocking lack."
Could you give an example?

Original comment by JohnnyJianHY on 13 Oct 2008 at 1:25

GoogleCodeExporter commented 9 years ago
Yes sure. This is again the runner example:

My code look something like this:
void doSomething(){
 runner.remote {
   run("println 'foo'")
 }
}

What I did is something like:
class MockRunner extends Mock {
  def runner(closure){
    closure.setDelegate(this)
    closure.call()
  }
}

Then in my test I was able to do:
void test(){
  def mockRunner = new MockRunner()
  mocks.add(mockRunner)

  mockRunner.run("println 'foo'")
  play {
    // replace the runner with the mock in the code and run it
  }
}

Original comment by julien.g...@gmail.com on 13 Oct 2008 at 5:44

GoogleCodeExporter commented 9 years ago
On my previous example change:
class MockRunner extends Mock {
  def runner(closure){
    closure.setDelegate(this)
    closure.call()
  }
}
with
class MockRunner extends Mock {
  def remote(closure){
    closure.setDelegate(this)
    closure.call()
  }
}

Original comment by julien.g...@gmail.com on 13 Oct 2008 at 5:45

GoogleCodeExporter commented 9 years ago
OK, I will leave Mock external until we implement closure mocking.

Original comment by JohnnyJianHY on 14 Oct 2008 at 1:43

GoogleCodeExporter commented 9 years ago

Original comment by JohnnyJianHY on 14 Oct 2008 at 1:01

GoogleCodeExporter commented 9 years ago

Original comment by JohnnyJianHY on 14 Oct 2008 at 2:53