Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mocking existing methods in Clojure

I am trying to use with-redefs and reify to mock methods in clojure. I do not have a clue on where to get started with those. Can anyone please give me an example of mocking a method? The documentation on the internet is of no help for me as I am totally confused with it at this point of time.

like image 495
srnvs Avatar asked Jan 24 '26 13:01

srnvs


1 Answers

The book "The Joy of Clojure (Manning)" might be a good starting point, section '13.2 Testing' has some information with regards to (among others) the technique you mentioned - using the with-redefs macro.

like image 98
Răzvan Petruescu Avatar answered Jan 26 '26 21:01

Răzvan Petruescu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!