I've been a zone leader with DZone since 2008, and I'm crazy about community. Every day I get to work with the best that JavaScript, HTML5, Android and iOS has to offer, creating apps that truly make at difference, as principal front-end architect at Avego. James is a DZone Zone Leader and has posted 639 posts at DZone. You can read more from them at their website. View Full User Profile

Clojure Expectations Colorized

  • submit to reddit
The current version of expectations (1.4.3) prints colorized results by default on non-windows boxes.

The following screenshot is an example of the output when no tests are failing:

And, the following screenshot is an example of the output when there are failures or errors:

Colorized output is one of those small things that is easy to de-prioritize, but once it's done you can't figure out why you didn't do it earlier. The code to colorize your results is very simple, and there's even a lib, colorize, if you prefer to simply include a dependency instead.

Of course, if you prefer to stick with non-colorized results that's possible as well - simply set the environment variable EXPECTATIONS_COLORIZE to 'false'.
Reference: http://blog.jayfields.com/2012/05/clojure-expectations-colorized.html


Fahmeed Nawaz replied on Tue, 2012/06/12 - 11:04am

> DB and DBCollection are completely thread safe. In fact, they are cached so you get the same instance no matter what.
Should the DB-Object be reused, or should I get a new one for each request in a web app?

Is that OK to save even the cached access to Mongo:

public class MyDAO {
private Collection coll;

public MyDAO() {
coll = new Mongo().getDB("myDB").getCollection("myCollection");

public Object getSomething() {
  return coll.find("...");

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.