Created
March 1, 2012 16:10
-
-
Save svdberg/1950883 to your computer and use it in GitHub Desktop.
Property resolver tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns propertyresolver.test.core | |
(:use [propertyresolver.core]) | |
(:use [clojure.test]) | |
(:use midje.sweet)) | |
;; "PropertyResolver resolve single reference" | |
(facts "replace should resolve a single reference" | |
(let [map-with-placeholder {:jndiname "${jndi.ref}" :jndi.ref "MyQueue"}] | |
(expand-placeholders map-with-placeholder map-with-placeholder) => {:jndi.ref "MyQueue" :jndiname "MyQueue"})) | |
(facts "replace multiple references" | |
(let [map-with-multiple-placeholders {:name "${first.name} ${last.name}" | |
:first.name "Elton" :last.name "John"}] | |
(expand-placeholders map-with-multiple-placeholders map-with-multiple-placeholders) => | |
{:first.name "Elton" :last.name "John" :name "Elton John"})) | |
(facts "resolve chained references" | |
(let [chained-references {:a "link to ${b}" | |
:b "another link to ${c}" | |
:c "target"}] | |
(expand-placeholders chained-references chained-references) => | |
{:c "target" :a "link to another link to target" :b "another link to target"})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment