Search in sources :

Example 6 with ENGINE_ID

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

the class LifeExtensionTest method incorrectLifeSupportExtensionUsageTest.

@Test
void incorrectLifeSupportExtensionUsageTest() {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(LifeExtensionIncorrectUsage.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) 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 7 with ENGINE_ID

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

the class SuppressOutputExtensionTest method shouldThrowExceptionOnMissingResourceLock.

@Test
void shouldThrowExceptionOnMissingResourceLock() {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(SuppressOutputExtensionIncorrectUsage.class)).execute().testEvents();
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(IllegalStateException.class), message(message -> message.contains("SuppressOutputExtension requires `@ResourceLock( Resources.SYSTEM_OUT )` annotation.")))));
}
Also used : 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) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) DiscoverySelectors.selectClass(org.junit.platform.engine.discovery.DiscoverySelectors.selectClass) EventConditions.finishedWithFailure(org.junit.platform.testkit.engine.EventConditions.finishedWithFailure) ResourceLock(org.junit.jupiter.api.parallel.ResourceLock) TestExecutionResultConditions.message(org.junit.platform.testkit.engine.TestExecutionResultConditions.message) Nested(org.junit.jupiter.api.Nested) 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) Resources(org.junit.jupiter.api.parallel.Resources) SuppressOutput(org.neo4j.test.rule.SuppressOutput) Events(org.junit.platform.testkit.engine.Events) Test(org.junit.jupiter.api.Test)

Example 8 with ENGINE_ID

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

the class ThreadLeakageGuardExtensionTest method threadLeakageTest.

@Test
void threadLeakageTest() throws InterruptedException {
    Events testEvents = EngineTestKit.engine(ENGINE_ID).selectors(selectClass(IncorrectThreadLeakage.class)).execute().allEvents();
    testEvents.assertThatEvents().haveExactly(1, event(finishedWithFailure(instanceOf(ExtensionContextException.class), message(message -> message.contains("1 leaked thread(s) detected")))));
    IncorrectThreadLeakage.cleanUp();
}
Also used : 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) ExtensionContextException(org.junit.jupiter.api.extension.ExtensionContextException) TestExecutionResultConditions.instanceOf(org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf) DisabledIfSystemProperty(org.junit.jupiter.api.condition.DisabledIfSystemProperty) 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) Events(org.junit.platform.testkit.engine.Events) ExtensionContextException(org.junit.jupiter.api.extension.ExtensionContextException) 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