The Growing Clojure Ecosystem - A Data Structures Library and Mocking Facility
The Growing Clojure Ecosystem - A Data Structures Library and Mocking Facility
Join the DZone community and get the full member experience.
Join For FreeJava-based (JDBC) data connectivity to SaaS, NoSQL, and Big Data. Download Now.
clj-ds
Karl Krukow loves Clojure, and he especially likes using the data structures. Even though Clojure is distributed as a .jar, the structures work best within Clojure. Since many clients require that he use Java, Krukow has authored a library that is able to capture some of the benefits of using Clojure data structures within Clojure.clj-ds is not dependent on the Clojure runtime and does not run any Clojure bootstrap process, so calling certain methods on PersistentHashMap that require loading of the entire Clojure runtime will not cause delays for a Java user. clj-ds will also support generics (Clojure doesn't have them) for the Java data structure library.
Clojure data structures are currently implemented in Java, but the language is moving towards being completely implemented in Clojure itself. This could make the data structures even more inconvenient to use in a Java environment. So the clj-ds project will maintain Java versions of the code.
Other JVM languages such as JRuby, Groovy, Jython, Scala, or Erjang could benefit from Krukow's implementation.

Atticus
atticus.mock is an alternative approach to mocking where the mocked function can be implemented as an inline function to perform any checking or return value calculation. The project currently has two macros to wrap the body of a mocked function. One will verify that a function is called once, and the other will verify that a function is called a predetermined number of times.The Once macro
;; define test, that should be called just once
(deftest mock-test
(atticus.mock/expects
[(f [arg]
(atticus.mock/once
(is (= arg 1) "Check argument")
arg))]
(is (= 1 (f 1)) "Call mocked function"))
Atticus includes this all Clojure mocking facility. The project's author, Hugo Duncan, says that most of the mocking tools in Clojure reflect the Java mocking libraries and don't harness more of Clojure's dynamic capabilities. Atticus follows the convention of implementing mocking by binding a function's var to a new function for the duration of the test. Atticus also has new support for mocking protocols.
You can find hundreds of other Clojure-related projects on GitHub such as Leiningen, Compojure, and then there's jclouds, which wants to be the Clojure cloud library.
Connect any Java based application to your SaaS data. Over 100+ Java-based data source connectors.
Opinions expressed by DZone contributors are their own.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}
{{ parent.urlSource.name }}