This commit is contained in:
Keith Donald
2008-04-24 02:21:31 +00:00
parent be62feb4ee
commit 148d722c42
2 changed files with 20 additions and 1 deletions

View File

@@ -52,6 +52,7 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry {
public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException,
FlowDefinitionConstructionException {
Assert.hasText(id, "An id is required to lookup a FlowDefinition");
try {
if (logger.isDebugEnabled()) {
logger.debug("Getting FlowDefinition with id '" + id + "'");
@@ -87,7 +88,7 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry {
public void registerFlowDefinition(FlowDefinitionHolder definitionHolder) {
Assert.notNull(definitionHolder, "The holder of the flow definition to register is required");
if (logger.isDebugEnabled()) {
logger.debug("Registering flow definition " + definitionHolder);
logger.debug("Registering flow definition held by " + definitionHolder);
}
flowDefinitions.put(definitionHolder.getFlowDefinitionId(), definitionHolder);
}

View File

@@ -47,6 +47,24 @@ public class FlowDefinitionRegistryImplTests extends TestCase {
}
}
public void testNullFlowDefinitionId() {
try {
registry.getFlowDefinition(null);
fail("Should have bombed with illegal argument");
} catch (IllegalArgumentException e) {
}
}
public void testBlankFlowDefinitionId() {
try {
registry.getFlowDefinition("");
fail("Should have bombed with illegal argument");
} catch (IllegalArgumentException e) {
}
}
public void testRegisterFlow() {
registry.registerFlowDefinition(new StaticFlowDefinitionHolder(fooFlow));
assertEquals(fooFlow, registry.getFlowDefinition("foo"));