Hi Berlin,

Your testDog needs a 'this' argument:

(defn -testDog [this]
  (println "Dog called on " this))

I played with generating JUnit classes when I started writing the  
book, and unless you have a specific need I would recommend using  
something like test-is for Clojure testing.

Cheers,
Stuart

>
> I asked this on IRC yesterday.  I think Chouser had a good suggestion
> but I forgot what it was.
>
> I am trying to use Junit to generate tests with Clojure.  May not be
> the best to use junit but I was going to try anyway.
>
> main.clj:
> (compile 'test.OctaneTestGen)
>
>
> (ns test.OctaneTestGen
>    (:gen-class
>     :extends junit.framework.TestCase
>     :methods [[testDog [] void]]))
>
> (defn -init [] ())
>
> (defn -testDog []
>  (println "Dog"))
>
> I tried this and get the following error.  Regardless, I still don't
> know the best way to ensure that those 'test' methods are available
> for junit.  I am assuming the proxying done at the gen-class level is
> not being liked by junit.
>
> .E
> Time: 0.015
> There was 1 error:
> 1) testDog(test.OctaneTestGen)java.lang.IllegalArgumentException:
> Wrong number o
> f args passed to: OctaneTestGen$-testDog
>        at clojure.lang.AFn.throwArity(AFn.java:450)
>        at clojure.lang.AFn.invoke(AFn.java:53)
>        at test.OctaneTestGen.testDog(Unknown Source)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
>        at test.OctaneTestGen.runTest(Unknown Source)
>        at test.OctaneTestGen.runBare(Unknown Source)
>        at test.OctaneTestGen.run(Unknown Source)
>
> FAILURES!!!
> Tests run: 1,  Failures: 0,  Errors: 1
>
> Anyone havea  suggestion.
>
> I am using junit-4.4
>
> Thanks
> -- Berlin Brown
> http://berlinbrowndev.blogspot.com
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to