package org.concordion.internal;
import org.concordion.api.Resource;
import org.concordion.api.SpecificationLocator;
import org.concordion.internal.util.Check;
public class ClassNameBasedSpecificationLocator implements SpecificationLocator {
public Resource locateSpecification(Object fixture) {
Check.notNull(fixture, "Fixture is null");
String dottedClassName = fixture.getClass().getName();
String slashedClassName = dottedClassName.replaceAll("\\.", "/");
String specificationName = slashedClassName.replaceAll("Test$", "");
String resourcePath = "/" + specificationName + ".html";
return new Resource(resourcePath);
}
}