Cristian
Cristian

Reputation: 43967

How to Mock a Java Object in Clojure

I'm exploring clojure.contrib.mock. I think I learned how to mock Clojure functions, but I don't see anything about mocking Java objects.

Is there a Clojure library to help me create Java mock objects or will I have to bring in libraries like EasyMock?

Upvotes: 11

Views: 1114

Answers (1)

Sean Corfield
Sean Corfield

Reputation: 6666

Depending on the Java objects you're trying to mock, you may find proxy and/or reify useful since they let you create Java-compatible objects in Clojure. Can you provide a more concrete example of what you're trying to do?

Upvotes: 7

Related Questions