|
Project Information
Links
|
Simple mock objects for javaCheesyMock is a small library for creating Java mock objects for use in your unit tests with a minimal amount of fuss. For example, to quickly create a dummy HttpServletRequest, you only need to type HttpServletRequest req = Cheesy.mock(HttpServletRequest.class); or, to create an InputStream that always throws an exception when you try to close it (which I've actually found helpful when writing some tests): InputStream is = Cheesy.mock(InputStream.class, new Object() {
void close() {
throw new IOException("bad luck, try again!");
}
});DocumentationFor up-to-date documentation, please see the javadoc for the main class, Cheesy.java. RequirementsCheesyMock requires Java 1.5. If you are running any previous version then seriously, what is wrong with you? You need CGLib on your class path if you want to create mock objects of concrete classes, otherwise you are restricted to create mocks from interfaces. Other than that, CheesyMock has no external dependencies. Versions
|