Class ServiceRegistryExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.TestExecutionExceptionHandler, org.junit.jupiter.api.extension.TestInstancePostProcessor

    public class ServiceRegistryExtension
    extends java.lang.Object
    implements org.junit.jupiter.api.extension.TestInstancePostProcessor, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.TestExecutionExceptionHandler
    JUnit extension used to manage the StandardServiceRegistry used by a test including creating the StandardServiceRegistry and releasing it afterwards
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterAll​(org.junit.jupiter.api.extension.ExtensionContext context)  
      static org.hibernate.boot.registry.StandardServiceRegistry findServiceRegistry​(java.lang.Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context)  
      static ServiceRegistryScope findServiceRegistryScope​(java.lang.Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context)  
      void handleTestExecutionException​(org.junit.jupiter.api.extension.ExtensionContext context, java.lang.Throwable throwable)  
      void postProcessTestInstance​(java.lang.Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ServiceRegistryExtension

        public ServiceRegistryExtension()
    • Method Detail

      • findServiceRegistry

        public static org.hibernate.boot.registry.StandardServiceRegistry findServiceRegistry​(java.lang.Object testInstance,
                                                                                              org.junit.jupiter.api.extension.ExtensionContext context)
      • findServiceRegistryScope

        public static ServiceRegistryScope findServiceRegistryScope​(java.lang.Object testInstance,
                                                                    org.junit.jupiter.api.extension.ExtensionContext context)
      • postProcessTestInstance

        public void postProcessTestInstance​(java.lang.Object testInstance,
                                            org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        postProcessTestInstance in interface org.junit.jupiter.api.extension.TestInstancePostProcessor
      • afterAll

        public void afterAll​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback
      • handleTestExecutionException

        public void handleTestExecutionException​(org.junit.jupiter.api.extension.ExtensionContext context,
                                                 java.lang.Throwable throwable)
                                          throws java.lang.Throwable
        Specified by:
        handleTestExecutionException in interface org.junit.jupiter.api.extension.TestExecutionExceptionHandler
        Throws:
        java.lang.Throwable