Categories
Development

Surrogate test objects

Surrogate is an open source project for mocking dependencies in unit tests. It enables you to unit test existing code, without modification even though it is not based on dependency injection. It does this through AspectJ weaving where it intercepts calls to objects that needs to be mocked. Take a look at it, it should solve some hard to solve test cases you might run into (like simulating slow performance by replacing calls to System.currentTimeMillis()).

According to java.no it has been developed by Telenor (Norways largest telecom company), and according to their own docs used in large projects with 4000 unit tests.

Leave a Reply

Your email address will not be published. Required fields are marked *