use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class LocalizedKeywordsBehaviour method shouldAllowKeywordsToBeConfigured.
@Test
public void shouldAllowKeywordsToBeConfigured() {
Configuration configuration = new MostUsefulConfiguration();
ensureKeywordsAreLocalised(configuration, new Locale("en"));
configuration.useKeywords(new LocalizedKeywords(new Locale("it")));
ensureKeywordsAreLocalised(configuration, new Locale("it"));
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class ScanningStepsFactoryBehaviour method shouldScanStepsFromPackagesAndFilterMatchingNames.
@Test
public void shouldScanStepsFromPackagesAndFilterMatchingNames() {
InjectableStepsFactory factory = new ScanningStepsFactory(new MostUsefulConfiguration(), "org.jbehave.core.steps.scan").matchingNames(".*GivenWhen.*").notMatchingNames(".*GivenWhenThen");
List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
assertThat(candidateSteps.size(), Matchers.equalTo(1));
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class ScanningStepsFactoryBehaviour method shouldScanStepsFromPackagesAndIgnoreClassesNotAnnotated.
@Test
public void shouldScanStepsFromPackagesAndIgnoreClassesNotAnnotated() {
InjectableStepsFactory factory = new ScanningStepsFactory(new MostUsefulConfiguration(), "org.jbehave.core.steps.scan", "org.jbehave.core.steps.scan2");
List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
assertThat(candidateSteps.size(), Matchers.equalTo(3));
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class ScanningStepsFactoryBehaviour method shouldScanStepsFromRootClass.
@Test
public void shouldScanStepsFromRootClass() {
InjectableStepsFactory factory = new ScanningStepsFactory(new MostUsefulConfiguration(), this.getClass());
List<CandidateSteps> candidateSteps = factory.createCandidateSteps();
assertThat(candidateSteps.size(), Matchers.greaterThan(1));
}
use of org.jbehave.core.configuration.MostUsefulConfiguration in project jbehave-core by jbehave.
the class StepCreatorBehaviour method shouldStoreAndReadObjects.
private void shouldStoreAndReadObjects(Method methodStoring, boolean resetContext) throws IntrospectionException {
// Given
if (resetContext) {
setupContext();
}
SomeSteps stepsInstance = new SomeSteps();
InjectableStepsFactory stepsFactory = new InstanceStepsFactory(new MostUsefulConfiguration(), stepsInstance);
StepMatcher stepMatcher = new RegexStepMatcher(StepType.WHEN, "I read from context", Pattern.compile("I read from context"), new String[] {});
StepCreator stepCreator = new StepCreator(stepsInstance.getClass(), stepsFactory, stepsContext, null, new ParameterControls(), stepMatcher, new SilentStepMonitor());
// When
Method methodRead = SomeSteps.methodFor("aMethodReadingFromContext");
StepResult stepResult = stepCreator.createParametrisedStep(methodStoring, "When I store in context", "I store in context", new HashMap<String, String>()).perform(null);
StepResult stepResultRead = stepCreator.createParametrisedStep(methodRead, "And I read from context", "I read from context", new HashMap<String, String>()).perform(null);
// Then
assertThat(stepResult, instanceOf(Successful.class));
assertThat(stepResultRead, instanceOf(Successful.class));
assertThat(stepsInstance.args, instanceOf(String.class));
assertThat((String) stepsInstance.args, is("someValue"));
}
Aggregations