Annotation Interface MockServerSettings


@ExtendWith(MockServerExtension.class) @Retention(RUNTIME) @Inherited public @interface MockServerSettings
Configure MockServer when used in conjunction with MockServerExtension
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
     
    int[]
     
    boolean
    When true the MockServer is reset (all expectations and recorded requests cleared) before each test method, so expectations set in one test do not bleed into the next when a single server instance is shared across the test class (or across the whole suite via perTestSuite()).
  • Element Details

    • perTestSuite

      boolean perTestSuite
      Default:
      false
    • ports

      int[] ports
      Default:
      {}
    • resetBeforeEach

      boolean resetBeforeEach
      When true the MockServer is reset (all expectations and recorded requests cleared) before each test method, so expectations set in one test do not bleed into the next when a single server instance is shared across the test class (or across the whole suite via perTestSuite()).

      Defaults to false to preserve the historic behaviour where the shared server is never reset between tests — leaving expectations set in @BeforeAll intact for every test in the class.

      The reset fires in the extension's BeforeEachCallback, which runs before any user @BeforeEach methods, so expectations registered in a @BeforeEach are safe — they are applied after the reset and are therefore present for the test that follows.

      When combined with perTestSuite() = true the reset clears the shared suite-wide server before each test, so isolation holds even across multiple test classes that share that one server.

      Default:
      false