Search in sources :

Example 1 with Meta

use of io.cucumber.messages.types.Meta in project cucumber-jvm by cucumber.

the class RuntimeTest method emits_a_meta_message.

@Test
void emits_a_meta_message() {
    List<Envelope> messages = new ArrayList<>();
    EventListener listener = publisher -> publisher.registerHandlerFor(Envelope.class, messages::add);
    Runtime.builder().withAdditionalPlugins(listener).build().run();
    Meta meta = messages.get(0).getMeta();
    assertThat(meta.getProtocolVersion(), matchesPattern("\\d+\\.\\d+\\.\\d+(-RC\\d+)?(-SNAPSHOT)?"));
    assertThat(meta.getImplementation().getName(), is("cucumber-jvm"));
    assertThat(meta.getImplementation().getVersion(), matchesPattern("\\d+\\.\\d+\\.\\d+(-RC\\d+)?(-SNAPSHOT)?"));
    assertThat(meta.getOs().getName(), matchesPattern(".+"));
    assertThat(meta.getCpu().getName(), matchesPattern(".+"));
}
Also used : ConcurrentEventListener(io.cucumber.plugin.ConcurrentEventListener) TestStepStarted(io.cucumber.plugin.event.TestStepStarted) StubStepDefinition(io.cucumber.core.backend.StubStepDefinition) IsEqual.equalTo(org.hamcrest.core.IsEqual.equalTo) Meta(io.cucumber.messages.types.Meta) Status(io.cucumber.plugin.event.Status) ScenarioScoped(io.cucumber.core.backend.ScenarioScoped) Collections.singletonList(java.util.Collections.singletonList) StepDefinedEvent(io.cucumber.plugin.event.StepDefinedEvent) Arrays.asList(java.util.Arrays.asList) CompositeCucumberException(io.cucumber.core.exception.CompositeCucumberException) Is.is(org.hamcrest.core.Is.is) URI(java.net.URI) TestBackendSupplier(io.cucumber.core.runner.TestBackendSupplier) HookDefinition(io.cucumber.core.backend.HookDefinition) TestFeatureParser(io.cucumber.core.feature.TestFeatureParser) StepDurationTimeService(io.cucumber.core.runner.StepDurationTimeService) Envelope(io.cucumber.messages.types.Envelope) Result(io.cucumber.plugin.event.Result) Collections.emptyList(java.util.Collections.emptyList) Glue(io.cucumber.core.backend.Glue) UUID(java.util.UUID) Instant(java.time.Instant) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) Matchers.matchesPattern(org.hamcrest.Matchers.matchesPattern) RuntimeOptionsBuilder(io.cucumber.core.options.RuntimeOptionsBuilder) TestRunFinished(io.cucumber.plugin.event.TestRunFinished) ZERO(java.time.Duration.ZERO) Mockito.mock(org.mockito.Mockito.mock) Plugin(io.cucumber.plugin.Plugin) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Matchers.arrayWithSize(org.hamcrest.Matchers.arrayWithSize) StepDefinition(io.cucumber.plugin.event.StepDefinition) ZoneId.of(java.time.ZoneId.of) TestStepFinished(io.cucumber.plugin.event.TestStepFinished) TestCase(io.cucumber.plugin.event.TestCase) EventListener(io.cucumber.plugin.EventListener) ArrayList(java.util.ArrayList) TestCaseStarted(io.cucumber.plugin.event.TestCaseStarted) ArgumentCaptor(org.mockito.ArgumentCaptor) ParameterInfo(io.cucumber.core.backend.ParameterInfo) TestCaseFinished(io.cucumber.plugin.event.TestCaseFinished) TestCaseState(io.cucumber.core.backend.TestCaseState) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) EventPublisher(io.cucumber.plugin.event.EventPublisher) EventBus(io.cucumber.core.eventbus.EventBus) Clock.fixed(java.time.Clock.fixed) TestRunStarted(io.cucumber.plugin.event.TestRunStarted) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) Executable(org.junit.jupiter.api.function.Executable) Feature(io.cucumber.core.gherkin.Feature) Clock(java.time.Clock) HOURS(java.util.concurrent.TimeUnit.HOURS) EPOCH(java.time.Instant.EPOCH) SECONDS(java.util.concurrent.TimeUnit.SECONDS) Meta(io.cucumber.messages.types.Meta) ArrayList(java.util.ArrayList) ConcurrentEventListener(io.cucumber.plugin.ConcurrentEventListener) EventListener(io.cucumber.plugin.EventListener) Envelope(io.cucumber.messages.types.Envelope) Test(org.junit.jupiter.api.Test)

Aggregations

Glue (io.cucumber.core.backend.Glue)1 HookDefinition (io.cucumber.core.backend.HookDefinition)1 ParameterInfo (io.cucumber.core.backend.ParameterInfo)1 ScenarioScoped (io.cucumber.core.backend.ScenarioScoped)1 StubStepDefinition (io.cucumber.core.backend.StubStepDefinition)1 TestCaseState (io.cucumber.core.backend.TestCaseState)1 EventBus (io.cucumber.core.eventbus.EventBus)1 CompositeCucumberException (io.cucumber.core.exception.CompositeCucumberException)1 TestFeatureParser (io.cucumber.core.feature.TestFeatureParser)1 Feature (io.cucumber.core.gherkin.Feature)1 RuntimeOptionsBuilder (io.cucumber.core.options.RuntimeOptionsBuilder)1 StepDurationTimeService (io.cucumber.core.runner.StepDurationTimeService)1 TestBackendSupplier (io.cucumber.core.runner.TestBackendSupplier)1 Envelope (io.cucumber.messages.types.Envelope)1 Meta (io.cucumber.messages.types.Meta)1 ConcurrentEventListener (io.cucumber.plugin.ConcurrentEventListener)1 EventListener (io.cucumber.plugin.EventListener)1 Plugin (io.cucumber.plugin.Plugin)1 EventPublisher (io.cucumber.plugin.event.EventPublisher)1 Result (io.cucumber.plugin.event.Result)1