Search in sources :

Example 6 with Events

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

the class JUnitUsageGuardExtensionTest method detectIncorrectAssertUsage.

@Test
void detectIncorrectAssertUsage() {
    Events testEvents = executeTest(IncorrectAssertUsage.class);
    verifyFailureMessage(testEvents, "Detected Junit 4 classes: [org.junit.Assert]");
}
Also used : Events(org.junit.platform.testkit.engine.Events) Test(org.junit.jupiter.api.Test)

Example 7 with Events

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

the class JUnitUsageGuardExtensionTest method detectIncorrectIgnoreNewTest.

@Test
void detectIncorrectIgnoreNewTest() {
    Events testEvents = executeTest(IgnoreNewTestWithOldAnnotation.class);
    verifyFailureMessage(testEvents, "Detected Junit 4 classes: [org.junit.Ignore]");
}
Also used : Events(org.junit.platform.testkit.engine.Events) Test(org.junit.jupiter.api.Test)

Example 8 with Events

use of org.junit.platform.testkit.engine.Events 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 9 with Events

use of org.junit.platform.testkit.engine.Events 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)

Example 10 with Events

use of org.junit.platform.testkit.engine.Events 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)

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