Package org.approvej

Class DanglingApprovalExtension

java.lang.Object
org.approvej.DanglingApprovalExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.Extension

@NullMarked public class DanglingApprovalExtension extends Object implements org.junit.jupiter.api.extension.AfterEachCallback
A JUnit Jupiter extension that detects dangling approvals after each test.

A dangling approval occurs when approve() is called without a concluding terminal method (by(), byFile(), or byValue()).

Use the ApprovalTest annotation on test classes to enable this extension, or register it directly via @ExtendWith(DanglingApprovalExtension.class).

See Also:
  • Constructor Details

    • DanglingApprovalExtension

      public DanglingApprovalExtension()
  • Method Details

    • afterEach

      public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
      Specified by:
      afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback