Class EnterpriseNeo4jExtension

java.lang.Object
org.neo4j.harness.junit.extension.Neo4jExtension
com.neo4j.harness.junit.extension.EnterpriseNeo4jExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.ParameterResolver

public class EnterpriseNeo4jExtension extends Neo4jExtension
Enterprise Neo4j JUnit 5 Extension. Allows easily start neo4j instance for testing purposes with junit 5 with various user-provided options and configurations. Can be registered declaratively with ExtendWith or programmatically using RegisterExtension.

By default, it will try to start neo4j with embedded web server on random ports. If more advance configuration is required please use programmatical extension registration and configure desired Neo4j behaviour using available options.

Please note that neo4j server uses dynamic ports and it is necessary for the test code to use Neo4j.httpURI() and then URI.resolve(String) to create the URIs to be invoked.

If starting the embedded web server is not desirable, it can be fully disabled by using Neo4jExtensionBuilder.withDisabledServer().

Usage example:

  
  @ExtendWith( EnterpriseNeo4jExtension.class )
       class TestExample {
              @Test
               void testExample( Neo4j neo4j, GraphDatabaseService databaseService ) {
                   // test code
               }
       }
  
 
See Also:
  • Constructor Details

    • EnterpriseNeo4jExtension

      public EnterpriseNeo4jExtension()
  • Method Details