19 Mar '13, 7pm

Clojure: Expectations Interaction Tests For Java Objects

I recently ran into some code that forced me to integrate with a Java library. While using the library I found myself wanting to do a bit of interaction testing, which I've historically done with Mockito. As a result, I added the ability to do interaction based tests on mock Java objects, directly in expectations . Hopefully the code is what you'd expect. The previous example creates a mock Runnable in an expect-let , expects the run method to be run, and then calls the run method of the mock. This test is worthless in a real world context, but it's the simplest way to demonstrate the syntax for creating a mock & specifying the interaction. The mock function defined in erajure , a minimal wrapper around mockito. All of the "times" arguments are the same as what's available for function interaction tests, examples can be found

Full article: http://blog.jayfields.com/2013/03/clojure-expectations-in...

Tweets

Jay Fields' Thoughts: Clojure: Expectations Int...

blog.jayfields.com 19 Mar '13, 6pm

I recently ran into some code that forced me to integrate with a Java library. While using the library I found myself want...

Jay Fields' Thoughts: Clojure: Expectations Ign...

blog.jayfields.com 21 Mar '13, 10am

Over the past year I've written the same test a few times. This test accomplishes what I'm looking for when I write it - v...

This: You have no idea how few unit tests I've ...

blog.jayfields.com 16 Mar '13, 4pm

2010 discussion repeatedly arose around the idea that unit tests hinder your ability to refactor and add new features. It'...

test

blog.jayfields.com 30 Mar '13, 5pm

Over the past year I've written the same test a few times. This test accomplishes what I'm looking for when I write it - v...

Analytics-powered, adaptive, conversion-marketing engine- scalability with Clojure instead of Erlang

Analytics-powered, adaptive, conversion-marketi...

rubylearning.com 20 Mar '13, 3pm

As I said earlier, I’ve used Scheme on my personal projects from time to time. At Runa, we always knew we could benefit fr...