Java Magazine, Sept/Oct 2017
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2017 66 jvm languages more It houses template projects to help you get started on a project quickly and it even ofers support for project add ons called profiles For example if I wanted to scaffold a new project via the luminus template with support for PostgreSQL I could simply open my terminal and run this lein new luminus myapp postgres Its important to note that each template hosts its own profiles so you might not be able to scafold with the postgres profile if youre using a diferent template Leinengen takes care of creating a project clj file for you which is similar to build gradle or package json files In it you can define your dependencies set up your projects metadata leverage Leinengen plugins and create your build pipeline Leinengen also features a rich read eval print loop REPL If youre familiar with Python or Node development youve probably found yourself testing out ideas via the Python integrated development and learning environment IDLE or the Node REPL Leinengens REPL is a similar idea Once you have Leinengen installed you can test new Clojure ideas with ease simply run lein repl from your command line Youll be placed into a clean Clojure environment where you can try new ideas Testing in Clojure Clojure ships with a lightweight testing library under the clojure test namespace It is built around the is macro which allows you to define assertions of arbitrary expressions Clojure gives you two patterns for documenting test cases the first is inline with your source code using the with test macro and the second allows you to place your tests in separate namespaces via the deftest macro Testing a simple arithmetic expression can be as simple as this ns demo hello tests deftest math tests
You must have JavaScript enabled to view digital editions.