/** * Constructor. Locates the specification with a type from the <code>specificationTypes</code> list. * Errors if unable to find exactly one specification of all the specified types. * * @param specificationTypes a list of types that this Concordion instance will check for (eg. html, md), with a converter for each type * @param specificationLocator locates the specification based on the specification type * @param specificationReader specification reader * @param evaluatorFactory evaluator factory * @param fixtureDeclarations a wrapper around the fixture class * @throws IOException on i/o error */ public Concordion(List<SpecificationType> specificationTypes, SpecificationLocator specificationLocator, SpecificationReader specificationReader, EvaluatorFactory evaluatorFactory, FixtureDeclarations fixtureDeclarations) throws IOException { this.specificationReader = specificationReader; this.evaluatorFactory = evaluatorFactory; SpecificationType specificationType = null; for (SpecificationType currentType : specificationTypes) { Resource currentResource = specificationLocator.locateSpecification(fixtureDeclarations, currentType.getTypeSuffix()); if (specificationReader.canFindSpecification(currentResource)) { if (specificationType != null) { throw new RuntimeException(createMultipleSpecsMessage(fixtureDeclarations, specificationType, currentType)); } specificationType = currentType; resource = currentResource; } } if (specificationType == null) { throw new RuntimeException(createUnableToFindSpecMessage(fixtureDeclarations, specificationTypes)); } specificationReader.setSpecificationConverter(specificationType.getConverter()); }
/** * Constructor. Locates the specification with a type from the <code>specificationTypes</code> list. * Errors if unable to find exactly one specification of all the specified types. * * @param specificationTypes a list of types that this Concordion instance will check for (eg. html, md), with a converter for each type * @param specificationLocator locates the specification based on the specification type * @param specificationReader specification reader * @param evaluatorFactory evaluator factory * @param fixtureDeclarations a wrapper around the fixture class * @throws IOException on i/o error */ public Concordion(List<SpecificationType> specificationTypes, SpecificationLocator specificationLocator, SpecificationReader specificationReader, EvaluatorFactory evaluatorFactory, FixtureDeclarations fixtureDeclarations) throws IOException { this.specificationReader = specificationReader; this.evaluatorFactory = evaluatorFactory; SpecificationType specificationType = null; for (SpecificationType currentType : specificationTypes) { Resource currentResource = specificationLocator.locateSpecification(fixtureDeclarations, currentType.getTypeSuffix()); if (specificationReader.canFindSpecification(currentResource)) { if (specificationType != null) { throw new RuntimeException(createMultipleSpecsMessage(fixtureDeclarations, specificationType, currentType)); } specificationType = currentType; resource = currentResource; } } if (specificationType == null) { throw new RuntimeException(createUnableToFindSpecMessage(fixtureDeclarations, specificationTypes)); } specificationReader.setSpecificationConverter(specificationType.getConverter()); }
public void testCanAppendDotXHTMLWhenConstructedWithXHTMLArgument() throws Exception { SpecificationLocator locator = new ClassNameBasedSpecificationLocator(); assertEquals("/org/concordion/internal/ClassNameBasedSpecificationLocator.xhtml", locator.locateSpecification(new FixtureType(this.getClass()), "xhtml").getPath()); } }
public void testRemovesWordTestFromEndOfClassNameAndAppendsDotHTML() throws Exception { SpecificationLocator locator = new ClassNameBasedSpecificationLocator(); assertEquals("/org/concordion/internal/ClassNameBasedSpecificationLocator.html", locator.locateSpecification(new FixtureType(this.getClass()), "html").getPath()); }
public void testRemovesWordFixtureFromEndOfClassNameAndAppendsDotHTML() throws Exception { SpecificationLocator locator = new ClassNameBasedSpecificationLocator(); assertEquals("/spec/concordion/common/command/execute/ContinueAfterExceptions.html", locator.locateSpecification(new FixtureType(ContinueAfterExceptionsFixture.class), "html").getPath()); }