cvs commit: spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/prevayler PrevaylerBeanTestCase.java
Mike Hogan <[email protected]> Mon, 10 Nov 2003 12:21:43 -0800
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
hogie 03/11/10 12:21:43
Added: sandbox/repository/componenthaus/src/tests/org/componenthaus/prevayler
PrevaylerBeanTestCase.java
Log:
Preview release with plexus-utils components
Revision Changes Path
1.1 spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/prevayler/PrevaylerBeanTestCase.java
Index: PrevaylerBeanTestCase.java
===================================================================
package org.componenthaus.prevayler;
import junit.framework.TestCase;
import org.componenthaus.tests.MockComponentRepository;
import org.prevayler.Command;
import org.prevayler.PrevalentSystem;
import java.io.Serializable;
public class PrevaylerBeanTestCase extends TestCase {
private PrevaylerBean bean = null;
private MockComponentRepository repo = null;
protected void setUp() throws Exception {
repo = new MockComponentRepository();
bean = new PrevaylerBean(repo);
}
public void testSystem() {
assertSame(repo, bean.system());
}
public void testCanExecuteCommand() throws Exception {
String preparedReturn = "jdladj";
final MockCommand command = new MockCommand(preparedReturn);
bean.executeCommand(command);
command.verify();
}
private static final class MockCommand implements Command {
private String preparedReturn = null;
private boolean called = false;
public MockCommand(String preparedReturn) {
this.preparedReturn = preparedReturn;
}
public Serializable execute(PrevalentSystem prevalentSystem) throws Exception {
called = true;
return preparedReturn;
}
public void verify() {
assertTrue(called);
}
}
}
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/