But here are my notes. Thanks to Josh and Lance for their examples. This page is a god-send:
http://bugs.sakaiproject.org/confluence/display/ENC/JUnit+Testing
I followed this cookbook and got to the point that the I had a simple unit test working, making its local beans, finding its local beans, using its local beans and then falling on its face.
I adapted Lance's code:
common-composite-component/src/test/org/sakaiproject/component/junit/spring/ApplicationContextBaseTest.java
I removed everything Hibernate from it and got a pure spring version. This worked once you set the variable on the maven call:
maven test -Dsakaiproject.basedir=/Users/csev/dev/sakai
Here is how it looks when it runs:
test:compile:
[javac] Compiling 1 source file to /Users/csev/dev/sakai/osid/component/target/test-classes
ApplicationContext=org.springframework.context.support.ClassPathXmlApplicationContext: display name [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=2790855]; startup date [Wed Oct 05 23:18:11 EDT 2005]; root of context hierarchy
org.osid.id.IdManager
ApplicationContext=org.springframework.context.support.ClassPathXmlApplicationContext: display name [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=1183826]; startup date [Wed Oct 05 23:18:11 EDT 2005]; root of context hierarchy
org.osid.id.IdManager
test:test:
[junit] Running org.sakaiproject.osid.test.IdManagerTest
Hello from my unit test...
Here we go..
idm=org.sakaiproject.component.osid.id.IdManager@d4461b
Exception...
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.042 sec
BUILD SUCCESSFUL
Total time: 6 seconds
Posted by csev at October 6, 2005 08:49 AM