Search in sources :

Example 1 with Events

use of org.junit.platform.testkit.engine.Events in project neo4j by neo4j.

the class DbmsExtensionTest method mixImpermanent.

@Test
void mixImpermanent() {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(DbmsExtensionMixImpermanent.class)).execute().testEvents();
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(ExtensionContextException.class))));
}
Also used : Events(org.junit.platform.testkit.engine.Events) ExtensionContextException(org.junit.jupiter.api.extension.ExtensionContextException) DbmsExtensionMixImpermanent(org.neo4j.test.extension.dbms.DbmsExtensionMixImpermanent) Test(org.junit.jupiter.api.Test)

Example 2 with Events

use of org.junit.platform.testkit.engine.Events in project neo4j by neo4j.

the class DbmsExtensionTest method checkCallbackSignature.

@Test
void checkCallbackSignature() {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(DbmsExtensionCheckCallbackSignature.class)).execute().testEvents();
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(IllegalArgumentException.class), message(message -> message.contains("must return void")))));
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(IllegalArgumentException.class), message(message -> message.contains("must take one parameter that is assignable from")))));
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(IllegalArgumentException.class), message(message -> message.contains("cannot be found.")))));
}
Also used : DbmsExtensionMixImpermanent(org.neo4j.test.extension.dbms.DbmsExtensionMixImpermanent) Events(org.junit.platform.testkit.engine.Events) ENGINE_ID(org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID) EventConditions.event(org.junit.platform.testkit.engine.EventConditions.event) DbmsExtensionEnforceAnnotations(org.neo4j.test.extension.dbms.DbmsExtensionEnforceAnnotations) DbmsExtensionCheckCallbackSignature(org.neo4j.test.extension.dbms.DbmsExtensionCheckCallbackSignature) DiscoverySelectors.selectClass(org.junit.platform.engine.discovery.DiscoverySelectors.selectClass) EventConditions.finishedWithFailure(org.junit.platform.testkit.engine.EventConditions.finishedWithFailure) TestExecutionResultConditions.message(org.junit.platform.testkit.engine.TestExecutionResultConditions.message) Test(org.junit.jupiter.api.Test) ExtensionContextException(org.junit.jupiter.api.extension.ExtensionContextException) TestExecutionResultConditions.instanceOf(org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf) EngineTestKit(org.junit.platform.testkit.engine.EngineTestKit) Events(org.junit.platform.testkit.engine.Events) DbmsExtensionCheckCallbackSignature(org.neo4j.test.extension.dbms.DbmsExtensionCheckCallbackSignature) Test(org.junit.jupiter.api.Test)

Example 3 with Events

use of org.junit.platform.testkit.engine.Events in project neo4j by neo4j.

the class LifeExtensionTest method componentShutdownAfterTest.

@Test
void componentShutdownAfterTest() {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(LifeExtensionComponentShutdownCase.class)).execute().testEvents();
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(RuntimeException.class), message(message -> message.contains("Shutdown exception.")))));
}
Also used : LifecycleAdapter(org.neo4j.kernel.lifecycle.LifecycleAdapter) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Events(org.junit.platform.testkit.engine.Events) ENGINE_ID(org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID) EventConditions.event(org.junit.platform.testkit.engine.EventConditions.event) DiscoverySelectors.selectClass(org.junit.platform.engine.discovery.DiscoverySelectors.selectClass) EventConditions.finishedWithFailure(org.junit.platform.testkit.engine.EventConditions.finishedWithFailure) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) TestExecutionResultConditions.message(org.junit.platform.testkit.engine.TestExecutionResultConditions.message) ExtensionConfigurationException(org.junit.jupiter.api.extension.ExtensionConfigurationException) Test(org.junit.jupiter.api.Test) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) TestExecutionResultConditions.instanceOf(org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf) EngineTestKit(org.junit.platform.testkit.engine.EngineTestKit) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Events(org.junit.platform.testkit.engine.Events) Test(org.junit.jupiter.api.Test)

Example 4 with Events

use of org.junit.platform.testkit.engine.Events in project neo4j by neo4j.

the class TestInstanceValidationExtensionTest method nonInjectedFieldVerified.

@Test
void nonInjectedFieldVerified() {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(InjectionIncorrectUsage.class)).execute().testEvents();
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(ExtensionConfigurationException.class), message(message -> message.contains("Field lifeSupport that is marked for injection")))));
}
Also used : ExtensionConfigurationException(org.junit.jupiter.api.extension.ExtensionConfigurationException) Test(org.junit.jupiter.api.Test) Events(org.junit.platform.testkit.engine.Events) ENGINE_ID(org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID) EventConditions.event(org.junit.platform.testkit.engine.EventConditions.event) TestExecutionResultConditions.instanceOf(org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf) EngineTestKit(org.junit.platform.testkit.engine.EngineTestKit) DiscoverySelectors.selectClass(org.junit.platform.engine.discovery.DiscoverySelectors.selectClass) EventConditions.finishedWithFailure(org.junit.platform.testkit.engine.EventConditions.finishedWithFailure) TestExecutionResultConditions.message(org.junit.platform.testkit.engine.TestExecutionResultConditions.message) ExtensionConfigurationException(org.junit.jupiter.api.extension.ExtensionConfigurationException) Events(org.junit.platform.testkit.engine.Events) Test(org.junit.jupiter.api.Test)

Example 5 with Events

use of org.junit.platform.testkit.engine.Events in project neo4j by neo4j.

the class VerboseTimeoutExceptionExtensionTest method executeTest.

private static Events executeTest(String method) {
    Events events = EngineTestKit.engine(ENGINE_ID).selectors(selectMethod(DumpThreadDumpOnTimeout.class, method)).execute().testEvents();
    events.assertStatistics(stats -> stats.finished(1));
    return events;
}
Also used : Events(org.junit.platform.testkit.engine.Events)

Aggregations

Events (org.junit.platform.testkit.engine.Events)16 Test (org.junit.jupiter.api.Test)15 DiscoverySelectors.selectClass (org.junit.platform.engine.discovery.DiscoverySelectors.selectClass)9 EngineTestKit (org.junit.platform.testkit.engine.EngineTestKit)9 EventConditions.event (org.junit.platform.testkit.engine.EventConditions.event)9 EventConditions.finishedWithFailure (org.junit.platform.testkit.engine.EventConditions.finishedWithFailure)9 TestExecutionResultConditions.instanceOf (org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf)9 TestExecutionResultConditions.message (org.junit.platform.testkit.engine.TestExecutionResultConditions.message)9 ENGINE_ID (org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID)8 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)4 ExtensionConfigurationException (org.junit.jupiter.api.extension.ExtensionConfigurationException)4 ExtensionContextException (org.junit.jupiter.api.extension.ExtensionContextException)4 Assertions.assertNotNull (org.junit.jupiter.api.Assertions.assertNotNull)3 DbmsExtensionMixImpermanent (org.neo4j.test.extension.dbms.DbmsExtensionMixImpermanent)3 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)2 Nested (org.junit.jupiter.api.Nested)2 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)2 LifecycleAdapter (org.neo4j.kernel.lifecycle.LifecycleAdapter)2 DbmsExtensionCheckCallbackSignature (org.neo4j.test.extension.dbms.DbmsExtensionCheckCallbackSignature)2 DbmsExtensionEnforceAnnotations (org.neo4j.test.extension.dbms.DbmsExtensionEnforceAnnotations)2