ano-prise mocking

ano-prise mocking is an easy to use mocking mini-framework. It actually consists of three classes and is totally easy to use.

consider you have an interface you want to test, let's call it TestInterface:

SVN: ano-prise/trunk/test/junit/net/anotheria/anoprise/mock/TestInterface.java

Unknown macro: {groovy}

def data = new URL('http://svn.anotheria.net/opensource/ano-prise/trunk/test/junit/net/anotheria/anoprise/mock/TestInterface.java').getText()
println '

' + data + '

'

Now consider you have to test another component which relies on one method of the TestInterface, what can you do?

  • Create a complete Mock.
  • Use easymock (or similar) for a replay like testing strategy.
  • Create a mock onthefly which only supports the methods you needs.

The later is what ano-prise Mocking does.

SVN: ano-prise/trunk/test/junit/net/anotheria/anoprise/mock/SimpleTest.java

Unknown macro: {groovy}

def data = new URL('http://svn.anotheria.net/opensource/ano-prise/trunk/test/junit/net/anotheria/anoprise/mock/SimpleTest.java').getText()
println '

' + data + '

'

  • No labels