In this example the last test fails.
I have used org.codehause.mojo.rpm.Mapping[1] as the example as this is where I discovered the bug.
[1] http://mojo.codehaus.org/rpm-maven-plugin/apidocs/org/codehaus/mojo/rpm/Mapping.html
Tests:
(do(use 'clojure.java.data'clojure.test)(import '[org.codehaus.mojo.rpm Mapping])
(testing "setting normally"
(let [mapping (Mapping.)](.setConfiguration mapping "a value")(.setDirectory mapping "/tmp")
(is (= (.getDirectory mapping) "/tmp"))(is (= (.getConfiguration mapping) "a value"))))
(testing "setting via java-data" (let [mapping (to-java Mapping {:configuration "a value" :directory "/tmp"})](is (= (.getDirectory mapping) "/tmp"))(is (= (.getConfiguration mapping) "a value")))))
clojure 1.5.1org.clojure/java.data 0.1.1
I am unable to reproduce this:
(! 930)-> clj -A:test:1.5 -Sdeps '{:deps {org.codehaus.mojo/rpm-maven-plugin {:mvn/version "RELEASE"}}}' Clojure 1.5.1 user=> (use 'clojure.java.data) nil user=> (import '(org.codehaus.mojo.rpm Mapping)) org.codehaus.mojo.rpm.Mapping user=> (def mapping (to-java Mapping {:configuration "a string" :directory "/tmp"})) #'user/mapping user=> (.getConfiguration mapping) "a string" user=>
It works as expected on later Clojure versions too.
In this example the last test fails.
I have used org.codehause.mojo.rpm.Mapping[1] as the example as this is where I discovered the bug.
[1] http://mojo.codehaus.org/rpm-maven-plugin/apidocs/org/codehaus/mojo/rpm/Mapping.html
Tests:
(do
(use 'clojure.java.data
'clojure.test)
(import '[org.codehaus.mojo.rpm Mapping])
(testing "setting normally"
(let [mapping (Mapping.)]
(.setConfiguration mapping "a value")
(.setDirectory mapping "/tmp")
(is (= (.getDirectory mapping) "/tmp"))
(is (= (.getConfiguration mapping) "a value"))))
(testing "setting via java-data"
(let [mapping (to-java Mapping {:configuration "a value" :directory "/tmp"})]
(is (= (.getDirectory mapping) "/tmp"))
(is (= (.getConfiguration mapping) "a value")))))