Advanced FeaturesUnit Test ExampleThe section presents a complete example of the unit test included in the hello tutorial.
block.xml
<container name="tutorial"> <component name="hello" class="tutorial.HelloComponent"/> </container> The test case implementation. package tutorial; import org.apache.avalon.merlin.unit.AbstractMerlinTestCase; /** * Hello Test Case. * * @author mcconnell@apache.org */ public class StandardTestCase extends AbstractMerlinTestCase { //-------------------------------------------------------- // constructors //-------------------------------------------------------- /** * @param name the name of the test case * @param root the merlin system install directory */ public StandardTestCase( String name ) { super( name ); } //-------------------------------------------------------- // testcase //-------------------------------------------------------- public void testServiceResolution() throws Exception { Object hello = resolve( "hello" ); assertTrue( hello != null ); } } |