Class CommonTestInjection.BreakpointSetter

java.lang.Object
org.apache.solr.common.util.CommonTestInjection.BreakpointSetter
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
CommonTestInjection

public static class CommonTestInjection.BreakpointSetter extends Object implements Closeable
Breakpoints should be set via this CommonTestInjection.BreakpointSetter within the test case and close should be invoked as cleanup. Since this is closeable, it should usually be used in the try-with-resource syntax, such as:

 try (BreakpointSetter breakpointSetter = new BreakpointSetter() {
     //... test code here that calls breakpointSetter.setImplementation(...)
 }
 
  • Constructor Details

    • BreakpointSetter

      public BreakpointSetter()
  • Method Details

    • setImplementation

      public void setImplementation(String key, CommonTestInjection.Breakpoint implementation)
      This is usually set by the test cases.

      If a breakpoint implementation is set by this method, then code execution would break at the code execution point marked by CommonTestInjection#injectBreakpoint with matching key, executes the provided implementation in the CommonTestInjection.Breakpoint, then resumes the normal code execution.

      Parameters:
      key - could simply be the fully qualified class name or more granular like class name + other id (such as method name). This should batch the key used in injectBreakpoint
      implementation - The Breakpoint implementation
      See Also:
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException