Search in sources :

Example 1 with ENGINE_ID

use of org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID 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 2 with ENGINE_ID

use of org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID 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 3 with ENGINE_ID

use of org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID 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 4 with ENGINE_ID

use of org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID in project neo4j by neo4j.

the class DefaultFileSystemExtensionTest method incorrectFileSystemExtensionUsage.

@Test
void incorrectFileSystemExtensionUsage() {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(IncorrectFileSystemUsage.class)).execute().testEvents();
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(ExtensionConfigurationException.class), message(message -> message.contains("Field fileSystem that is marked for injection")))));
}
Also used : ExtensionConfigurationException(org.junit.jupiter.api.extension.ExtensionConfigurationException) 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) TestExecutionResultConditions.message(org.junit.platform.testkit.engine.TestExecutionResultConditions.message) Nested(org.junit.jupiter.api.Nested) ExtensionConfigurationException(org.junit.jupiter.api.extension.ExtensionConfigurationException) Assertions.assertSame(org.junit.jupiter.api.Assertions.assertSame) Test(org.junit.jupiter.api.Test) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) TestExecutionResultConditions.instanceOf(org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf) EngineTestKit(org.junit.platform.testkit.engine.EngineTestKit) Events(org.junit.platform.testkit.engine.Events) Test(org.junit.jupiter.api.Test)

Example 5 with ENGINE_ID

use of org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID in project neo4j by neo4j.

the class DbmsExtensionTest method enforceAnnotation.

@Test
void enforceAnnotation() {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(DbmsExtensionEnforceAnnotations.class)).execute().testEvents();
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(IllegalArgumentException.class), message(message -> message.contains("must be annotated")))));
}
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) DbmsExtensionEnforceAnnotations(org.neo4j.test.extension.dbms.DbmsExtensionEnforceAnnotations) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)8 ENGINE_ID (org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.ENGINE_ID)8 DiscoverySelectors.selectClass (org.junit.platform.engine.discovery.DiscoverySelectors.selectClass)8 EngineTestKit (org.junit.platform.testkit.engine.EngineTestKit)8 EventConditions.event (org.junit.platform.testkit.engine.EventConditions.event)8 EventConditions.finishedWithFailure (org.junit.platform.testkit.engine.EventConditions.finishedWithFailure)8 Events (org.junit.platform.testkit.engine.Events)8 TestExecutionResultConditions.instanceOf (org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf)8 TestExecutionResultConditions.message (org.junit.platform.testkit.engine.TestExecutionResultConditions.message)8 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)4 ExtensionConfigurationException (org.junit.jupiter.api.extension.ExtensionConfigurationException)4 Assertions.assertNotNull (org.junit.jupiter.api.Assertions.assertNotNull)3 ExtensionContextException (org.junit.jupiter.api.extension.ExtensionContextException)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 DbmsExtensionMixImpermanent (org.neo4j.test.extension.dbms.DbmsExtensionMixImpermanent)2