cvs commit: spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/repository/api RepositoryImplTestCase.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/repository/api
RepositoryImplTestCase.java
Log:
Preview release with plexus-utils components
Revision Changes Path
1.1 spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/repository/api/RepositoryImplTestCase.java
Index: RepositoryImplTestCase.java
===================================================================
package org.componenthaus.repository.api;
import junit.framework.TestCase;
import org.componenthaus.tests.MockComponentRepositoryMonitor;
import org.componenthaus.tests.MockComponent;
import java.io.File;
public class RepositoryImplTestCase extends TestCase {
private RepositoryImpl repository = null;
private MockComponentRepositoryMonitor monitor = null;
protected void setUp() throws Exception {
monitor = new MockComponentRepositoryMonitor();
repository = new RepositoryImpl(monitor);
}
public void testCanAddComponent() {
MockComponent component = new MockComponent(null);
monitor.setupExpectedComponent(component);
String newId = repository.add(component);
assertEquals("0", newId);
assertEquals(newId,component.getId());
assertSame(component,repository.getComponent(newId));
monitor.verify();
}
public void testCanListComponents() {
assertEquals(0,repository.listComponents().size());
final MockComponent component = new MockComponent(null);
repository.add(component);
assertEquals(1,repository.listComponents().size());
assertTrue(repository.listComponents().contains(component));
}
public void testCanGetComponent() {
String componentId = "0";
assertNull(repository.getComponent(componentId));
final MockComponent component = new MockComponent(null);
repository.add(component);
assertSame(component,repository.getComponent(componentId));
}
public void testCanRegisterAndRetrieveDownloadables() {
String componentId = "0";
assertNull(repository.getDownloadable(componentId));
File file = new File("");
repository.registerDownloadable(componentId,file);
assertSame(file,repository.getDownloadable(componentId));
}
}
-------------------------------------------------------
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/