Search in sources :

Example 1 with InjectableEmbedder

use of org.jbehave.core.InjectableEmbedder in project jbehave-core by jbehave.

the class AnnotationBuilderBehaviour method shouldCreateEmbeddableInstanceFromInjectableEmbedderWithoutStepsFactory.

@Test
public void shouldCreateEmbeddableInstanceFromInjectableEmbedderWithoutStepsFactory() {
    AnnotationBuilder annotatedInjectable = new AnnotationBuilder(AnnotedInjectableWithoutStepsFactory.class);
    Object instance = annotatedInjectable.embeddableInstance();
    assertThat(instance, Matchers.instanceOf(InjectableEmbedder.class));
    Embedder embedder = ((InjectableEmbedder) instance).injectedEmbedder();
    assertThat(embedder.configuration().keywords(), instanceOf(MyKeywords.class));
    assertThat(embedder.metaFilters(), equalTo(asList("+embedder injectable")));
    assertThatStepsInstancesAre(embedder.candidateSteps(), MySteps.class);
}
Also used : InjectableEmbedder(org.jbehave.core.InjectableEmbedder) UsingEmbedder(org.jbehave.core.annotations.UsingEmbedder) ConfigurableEmbedder(org.jbehave.core.ConfigurableEmbedder) InjectableEmbedder(org.jbehave.core.InjectableEmbedder) Embedder(org.jbehave.core.embedder.Embedder) Test(org.junit.Test)

Example 2 with InjectableEmbedder

use of org.jbehave.core.InjectableEmbedder in project jbehave-core by jbehave.

the class AnnotationBuilderBehaviour method shouldCreateEmbeddableInstanceFromInjectableEmbedder.

@Test
public void shouldCreateEmbeddableInstanceFromInjectableEmbedder() {
    AnnotationBuilder annotatedInjectable = new AnnotationBuilder(AnnotedInjectable.class);
    Object instance = annotatedInjectable.embeddableInstance();
    assertThat(instance, Matchers.instanceOf(InjectableEmbedder.class));
    Embedder embedder = ((InjectableEmbedder) instance).injectedEmbedder();
    assertThat(embedder.configuration().keywords(), instanceOf(MyKeywords.class));
    assertThat(embedder.metaFilters(), equalTo(asList("+embedder injectable")));
    assertThat(embedder.systemProperties().getProperty("one"), equalTo("One"));
    assertThat(embedder.systemProperties().getProperty("two"), equalTo("Two"));
    assertThatStepsInstancesAre(embedder.stepsFactory().createCandidateSteps(), MySteps.class);
}
Also used : InjectableEmbedder(org.jbehave.core.InjectableEmbedder) UsingEmbedder(org.jbehave.core.annotations.UsingEmbedder) ConfigurableEmbedder(org.jbehave.core.ConfigurableEmbedder) InjectableEmbedder(org.jbehave.core.InjectableEmbedder) Embedder(org.jbehave.core.embedder.Embedder) Test(org.junit.Test)

Aggregations

ConfigurableEmbedder (org.jbehave.core.ConfigurableEmbedder)2 InjectableEmbedder (org.jbehave.core.InjectableEmbedder)2 UsingEmbedder (org.jbehave.core.annotations.UsingEmbedder)2 Embedder (org.jbehave.core.embedder.Embedder)2 Test (org.junit.Test)2