Package org.mockserver.junit.jupiter
Annotation Interface MockServerSettings
@ExtendWith(MockServerExtension.class)
@Retention(RUNTIME)
@Inherited
public @interface MockServerSettings
Configure MockServer when used in conjunction with
MockServerExtension-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanint[]booleanWhentruethe 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 viaperTestSuite()).
-
Element Details
-
perTestSuite
boolean perTestSuite- Default:
- false
-
ports
int[] ports- Default:
- {}
-
resetBeforeEach
boolean resetBeforeEachWhentruethe 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 viaperTestSuite()).Defaults to
falseto preserve the historic behaviour where the shared server is never reset between tests — leaving expectations set in@BeforeAllintact for every test in the class.The reset fires in the extension's
BeforeEachCallback, which runs before any user@BeforeEachmethods, so expectations registered in a@BeforeEachare safe — they are applied after the reset and are therefore present for the test that follows.When combined with
perTestSuite()= truethe 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
-