JUnit 5 & Jupiter: Lifecycle, Nested & Parameterized Tests

Learn JUnit Jupiter 5.14.4 lifecycle rules, nested tests, and parameterized inputs, with runnable setup order and practical isolation guidance.

published: reading time: 23 min read author: Geek Workbench updated: November 20, 2026
Quick Summary

Examples use JUnit Jupiter 5.14.4 on JUnit Platform 1.14.4. See how lifecycle methods run, when PER_CLASS allows instance @BeforeAll, and how nested and parameterized tests fit without sharing mutable fixtures.

JUnit 5 & Jupiter: Test Lifecycle, Nested Tests, Parameterized Tests

Introduction

JUnit 5 consists of the JUnit Platform, Jupiter, and Vintage. The Platform launches test engines, Jupiter provides the programming and extension models for writing tests, and Vintage runs JUnit 3 and 4 tests on the Platform.

The examples target JUnit Jupiter 5.14.4 with JUnit Platform 1.14.4, which supports Java 8 and later. At this update, JUnit 6.1.3 is the current release; the versioned JUnit 5 guide below matches these examples.

This guide covers lifecycle methods, nested tests, and parameterized tests, with examples that keep mutable test data isolated.

When to Use and When to Avoid Each Feature

@BeforeAll suits a resource that is expensive to create and safe for tests to share, such as a local test server. By default, its method must be static. Use @TestInstance(Lifecycle.PER_CLASS) when an instance method is needed, and close class-scoped resources in @AfterAll.

@BeforeEach prepares fresh state for one test: a new list, a temporary file, or a reset mock. It runs before each test method, including tests in nested classes.

Do not move a mutable fixture into class-level setup just to save construction time. Small fixtures are usually cheap to recreate, and a fresh copy prevents one test from affecting another. Share expensive external resources only when the tests can isolate their data and clean up reliably.

@Nested is useful when a group of tests shares setup that other tests do not need. If you have a repository test with ten methods for add() and five methods for delete(), nesting lets you put add tests in one inner class with their own setup and delete tests in another. It communicates intent: these tests belong together.

Do not nest when there is no meaningful shared setup, and do not nest more than two or three levels. If you find yourself writing @Nested class InnerClass3LevelDeep, step back and ask whether those should be separate test classes instead.

Parameterized tests work when the same assertions apply to different inputs, such as boundary values or constructor arguments. If cases need different assertions, use separate named tests instead of branching on the input inside one parameterized method.

Test Lifecycle Phases

This runnable example fixes the test method order and runs it on one thread, so its output is predictable even if the build enables parallel execution. Without @TestMethodOrder, do not rely on a particular order between test methods.

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Execution;
import org.junit.jupiter.api.ExecutionMode;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

@Execution(ExecutionMode.SAME_THREAD)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class LifecycleOrderTest {

    @BeforeAll
    static void beforeAll() {
        System.out.println("@BeforeAll");
    }

    @BeforeEach
    void beforeEach() {
        System.out.println("@BeforeEach");
    }

    @Test
    @Order(1)
    void firstTest() {
        System.out.println("first test");
    }

    @Test
    @Order(2)
    void secondTest() {
        System.out.println("second test");
    }

    @AfterEach
    void afterEach() {
        System.out.println("@AfterEach");
    }

    @AfterAll
    static void afterAll() {
        System.out.println("@AfterAll");
    }
}

The output is @BeforeAll, then @BeforeEach, the first test, and @AfterEach; that per-test sequence repeats for the second test, followed by @AfterAll. The default PER_METHOD lifecycle also creates a fresh test instance for each test method.

Common Mistakes with Lifecycle Annotations

By default, @BeforeAll and @AfterAll must be static because JUnit uses a new test instance per method. To use instance lifecycle methods, annotate the class with @TestInstance(TestInstance.Lifecycle.PER_CLASS). This shares one test instance, so reset any mutable instance state in @BeforeEach. The per-class lifecycle also permits non-static @BeforeAll methods in nested test classes.

A subtler mistake: assuming @BeforeEach runs once per nested class. It does not. The outer @BeforeEach runs for every test in the class, including tests in nested classes. Each nested class can also declare its own @BeforeEach, which runs in addition to the outer one. If this surprises you, write a small test class with logging and run it to see the actual sequence.

The third issue is assuming a fixed execution order across classes in parallel mode. JUnit 5 can run tests in parallel, and while @BeforeAll within a class runs sequentially, classes do not have a guaranteed order. If your tests depend on each other, that is a design problem, not something lifecycle annotations can fix.

Trade-Off Comparison

Feature Best For Avoid When Key Consideration
@BeforeAll Safe class-scoped resources Mutable test data Static by default; PER_CLASS allows instance methods
@BeforeEach Fresh per-test state Setup cost > test cost Runs for every test method
@Nested Grouping related assertions Deep nesting, unrelated tests Inner classes inherit outer lifecycle
@ParameterizedTest Data-driven equivalence tests Different assertion logic per input Keep parameter count reasonable
@CsvSource Inline small datasets Large data files Use for under 20 rows
@MethodSource External or computed data Simple inline data Better for complex object construction

Implementation Examples

Nested Tests

import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

class NestedListTest {

    List<String> list;

    @BeforeEach
    void setUp() {
        list = new ArrayList<>();
    }

    @Nested
    class WhenEmpty {

        @BeforeEach
        void setUpEmpty() {
            list.clear();
        }

        @Test
        void sizeShouldBeZero() {
            assertEquals(0, list.size());
        }

        @Test
        void addShouldWork() {
            list.add("item");
            assertEquals(1, list.size());
        }
    }

    @Nested
    class WhenPopulated {

        @BeforeEach
        void setUpPopulated() {
            list.add("initial");
            list.add("items");
        }

        @Test
        void sizeShouldBeTwo() {
            assertEquals(2, list.size());
        }

        @Test
        void clearShouldWork() {
            list.clear();
            assertTrue(list.isEmpty());
        }
    }
}

The default PER_METHOD lifecycle gives each test a fresh test instance. The outer setUp() creates a new list before each test; a nested class can then add setup for its own case. The inner lifecycle method supplements the outer one, so each test starts from fresh data instead of reusing a mutable list across test methods.

Parameterized Tests with @CsvSource

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import static org.junit.jupiter.api.Assertions.*;

class CsvSourceDemoTest {

    @ParameterizedTest
    @CsvSource({
        "1, 2, 3",
        "4, 5, 9",
        "10, 20, 30"
    })
    void shouldAddTwoNumbers(int a, int b, int expected) {
        assertEquals(expected, a + b);
    }
}

Three rows, three test invocations. JUnit reports each one separately, so a failure tells you exactly which row caused it.

Parameterized Tests with @MethodSource

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.Arguments;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.*;

class MethodSourceDemoTest {

    static Stream<Arguments> stringCombinations() {
        return Stream.of(
            Arguments.of("hello", "world", "hello world"),
            Arguments.of("junit", "5", "junit 5"),
            Arguments.of("", "", ""),
            Arguments.of("a", "b", "a b")
        );
    }

    @ParameterizedTest
    @MethodSource("stringCombinations")
    void shouldConcatenateStrings(String first, String second, String expected) {
        assertEquals(expected, first + " " + second);
    }
}

By default, the factory method must be static and return Stream<Arguments>. A class using @TestInstance(Lifecycle.PER_CLASS) may use an instance factory. Wrap multiple parameters in Arguments.of(…); single-parameter cases can return Stream<String> directly.

When a factory transforms or filters generated cases, the Stream API guide covers the Java operations used to build that data. Here, @MethodSource is the JUnit mechanism that supplies the resulting arguments to each invocation.

Observability Checklist

A well-observable test suite makes debugging failures less painful. Work through this checklist when setting up your test classes.

  • Lifecycle methods log their invocation when running in verbose mode
  • Parameterized test invocations are reported with their input values
  • Nested test class names appear clearly in reports, not just method names
  • @Disabled tests appear as skipped, not silently omitted
  • Configure test execution order explicitly when a test depends on it
  • Assertion failures include enough context to identify the failing input
  • @Tag annotations appear correctly in build tool reports

Security Notes

Shared mutable fixtures can make tests order-dependent, and concurrent access can introduce data races. JUnit’s per-method instance lifecycle does not isolate static fields, system properties, or external services.

Give each test its own mutable data. When tests must share an external resource, isolate records by test or serialize access where needed. Use mocks for external services, and use test accounts with limited permissions when integration testing is necessary.

Teardown matters. If an integration test logs sensitive data in setUp(), clear it in tearDown(). This is easy to overlook when the test itself “passes” but leaves data in logs or thread-local storage.

Common Pitfalls / Anti-Patterns

@BeforeAll is static by default. If instance-level setup is useful, use @TestInstance(TestInstance.Lifecycle.PER_CLASS) and reset mutable fixture fields in @BeforeEach, since all methods then use the same test instance.

Parameter count mismatches are the other frequent issue. If your @CsvSource has five columns and your method takes four parameters, JUnit throws ParameterResolutionException at runtime. The message tells you which parameter failed to resolve, so the fix is usually obvious once you count the columns against the signature.

@MethodSource factories are static by default. A per-class test instance may use an instance factory, but avoid using it to share mutable fixture data between invocations.

When NOT to Use

These features trip people up more often than you might expect.

Deeply Nested Classes

@Nested stops helping after two levels. Every level adds complexity: you have to remember which @BeforeEach hooks run, what scope your variables live in, and how inheritance interacts with lifecycle annotations. A three-level hierarchy like OuterTests > InnerTests > DeepTests ends up being harder to maintain than it is worth. If you catch yourself writing Assertions.assertAll chains to group assertions from nested classes, flatten the structure. Split test classes by concern and extract shared logic into utility methods. Nested classes work best when they group a handful of related assertions, not when they try to model every variation of your test scenarios.

@BeforeAll With Instance State

@BeforeAll methods that modify instance fields cause subtle failures that are difficult to track down. Because @BeforeAll runs once before any test in the class, any state it sets can be stale by the time most tests execute. A test that assumes freshly initialized state breaks silently when someone adds a new test with different expectations. If you need initialization before each test, use @BeforeEach. Save @BeforeAll for one-time setup like opening a database connection or loading static configuration. When you genuinely need @BeforeAll with instance state, write explicit assertions in @BeforeEach that fail with a clear message if the state is not what the test expects.

Parameterized Tests With Divergent Assertions

Parameterized tests work well when every invocation runs the same assertions against different inputs. They become unwieldy when different parameter sets require different assertions. Imagine a test that validates parsing for valid inputs but also checks error handling for invalid ones. Mixing both in a single parameterized method means some arguments trigger assertThrows while others trigger assertEquals. The resulting code is harder to read than separate test methods with descriptive names. Test reports also become confusing: did the “invalid input” case pass because parsing correctly threw an exception, or because it failed for the wrong reason? When your parameter combinations have different assertion logic, use separate test methods or separate test classes instead.

@RepeatedTest for Simple Repetition

@RepeatedTest verifies that behavior stays consistent across runs. It is not a replacement for proper stress testing or property-based testing. If you find yourself writing @RepeatedTest(1000) to catch intermittent failures, stop and think about what is actually happening. @RepeatedTest does not isolate test runs from each other, so if iteration 500 leaves state that iteration 501 depends on, you have hidden coupling between repetitions. Use @RepeatedTest for genuinely repeated scenarios like verifying a parser handles many variations of valid input. For everything else, use proper state management or dedicated stress testing tools.

Dynamic Tests for One-Off Checks

@TestFactory generates tests dynamically at runtime. It is genuinely useful for property-based testing or when the test structure itself comes from external data. For most ad-hoc checks, it creates more problems than it solves. Dynamic tests skip the JUnit lifecycle, which means no @BeforeEach, no @AfterEach, no extensions, and in many cases, no IDE test tree support. If you want a one-off test based on runtime data, a regular @Test method with a loop and @AfterEach cleanup is usually clearer. Save @TestFactory for cases where the test structure must come from external input, not just the test data.

CI and Integration-Test Failures

Tests that pass locally can still fail in CI or when they share integration-test resources. These are common causes.

Parallel Execution Exposing Shared State

JUnit 5 supports parallel test execution via junit.jupiter.execution.parallel.enabled=true. Parallel execution can expose shared mutable state that sequential runs do not. A static collection written by multiple tests can race and produce intermittent failures. Prefer fresh data per test. If a shared resource cannot be isolated, protect access or disable concurrent execution for the affected tests until they are safe to run together.

@BeforeAll Static Method Mistakes

An invalid lifecycle method can be reported differently by an IDE and a build tool, especially when they use different JUnit versions or configuration. Confirm that both run the same Jupiter and Platform versions. Also check for exceptions in inherited @BeforeAll methods when a test class appears to have no discovered tests.

Test Isolation Failures With Database State

Integration tests that reuse database records can affect each other when execution order changes or parallel execution begins. Give each test its own transaction with rollback, schema, or uniquely identified records. A separate connection alone does not isolate rows in a shared schema.

Parameter Resolution Exceptions in CI

ParameterResolutionException shows up when the test runs in an environment where classpath scanning behaves differently. A @CsvSource with an escaped comma in a quoted string might parse fine in your IDE but fail in Maven due to different character encoding or line endings. Similarly, a @MethodSource referring to a factory method by name fails if the method is not visible because of package-private access across modules. Use fully qualified factory method names in @MethodSource to avoid ambiguity. For CSV sources, keep quoted strings simple or use @NullSource and @EmptySource for edge cases instead of encoding them inline.

Extension Registration Missing in Production Build

JUnit 5 extensions registered via @ExtendWith in a superclass are inherited, but only when the superclass is on the classpath. In a multi-module project, if the module with the base test class is not a dependency of the module with the concrete tests, the extension never loads. This shows up as tests that run but skip critical setup logic: no mocked services, no populated fixtures, no custom assertions. The tests appear to pass because nothing fails, but they are not actually testing what you think they are. Verify extension registration in CI by checking that lifecycle methods actually run. Adding a logging assertion or a static counter in the extension confirms it was instantiated.

Quick Recap

  • @BeforeAll methods are static by default; switch to PER_CLASS lifecycle only when you need instance @BeforeAll
  • @BeforeEach runs for every test method, including those in nested classes
  • Outer @BeforeEach fires before inner @BeforeEach in nested classes, not instead of it
  • Use @CsvSource for small inline datasets, @MethodSource for anything complex
  • @MethodSource factories are static by default and return Stream<Arguments>; PER_CLASS also permits instance factories
  • Do not use static mutable fields; they break parallel execution
  • Tag tests for selective execution via build tools
  • Teardown resources in @AfterAll to prevent leaks across test classes

Interview Questions

1. Why does @BeforeAll need to be static by default in JUnit 5 Jupiter?

JUnit uses PER_METHOD by default, creating a new test instance for each test method. That is why @BeforeAll and @AfterAll are static by default. Add @TestInstance(TestInstance.Lifecycle.PER_CLASS) to use instance lifecycle methods; then reset mutable instance state in @BeforeEach.

2. How do lifecycle methods behave in nested test classes?

Outer class lifecycle methods apply to everything in the class, nested classes included. If the outer class has @BeforeEach, it runs before every test, including tests in nested classes. Nested classes can also declare their own lifecycle methods, which run in addition to the outer ones. The order for a nested test is: outer @BeforeAll, outer @BeforeEach, inner @BeforeEach, test, inner @AfterEach, outer @AfterEach. After all tests finish, outer @AfterAll fires once. This layering lets you set up shared context at the outer level and specific context per nested group.

3. What is the difference between @CsvSource and @MethodSource for parameterized tests?

@CsvSource puts small rows of values beside the test method. @MethodSource names a factory for computed values or complex objects and commonly returns Stream<Arguments>. The factory is static by default; a class using @TestInstance(Lifecycle.PER_CLASS) may use an instance factory.

4. What are the security implications of shared state in test classes?

Shared mutable fixtures can make results depend on test order, and parallel access can introduce data races. Keep mutable test data local to each test. If integration tests handle sensitive values, use limited test accounts and avoid writing secrets to logs.

5. How would you debug a ParameterResolutionException in a @ParameterizedTest?

The exception means the number or type of arguments from your source does not match your test method parameters. Start by counting the CSV columns or Arguments.of() entries against your method signature. With @CsvSource, verify every row has the same number of columns. With @MethodSource, confirm the factory returns Stream<Arguments> with the right number of values per call. Type mismatches also trigger this exception, so check that a value like "true" can be parsed to your target type, such as boolean. The exception message usually names the parameter that failed, which makes the fix straightforward once you compare the data against the signature.

6. What is @TestInstance(Lifecycle.PER_CLASS) and when would you use it?

By default, JUnit creates a new test instance for each method. @TestInstance(Lifecycle.PER_CLASS) creates one per class and permits instance-level @BeforeAll and @AfterAll. Use it when that lifecycle is useful, then reset mutable instance fields in @BeforeEach so one test cannot affect another.

7. How does @Nested interact with inheritance and test execution order?

Nested classes run the outer lifecycle methods as well as their own. The outer @BeforeEach runs before the nested class's @BeforeEach, and the @AfterEach methods run in reverse order. JUnit does not guarantee a particular test method order by default; use @TestMethodOrder only when order is part of the test design.

8. What are the tradeoffs between @CsvSource and @MethodSource?

@CsvSource is inline and visible directly in the test, making it ideal for small datasets of fewer than 20 rows with simple types like primitives or strings. The downside is that large inline data clutters the test method. @MethodSource references a separate factory method, which keeps the test clean for complex data but requires navigating to the factory to understand the inputs. @MethodSource also supports external data sources, computed values, and complex object construction that would be unwieldy in CSV format. Use @CsvSource for quick sanity checks and boundary value tests; use @MethodSource for anything that requires logic to generate the test cases.

9. Why should static mutable fields be avoided in test classes?

Static mutable fields survive across test instances, so one test can leave data for another to see. Parallel tests can also race when they access the same field. Prefer instance fields initialized with fresh data in @BeforeEach; use synchronization or resource locks only when sharing is required.

10. How do you handle tests that need resources from external systems like databases?

Give each test isolated database state with a transaction that rolls back, a separate schema, or records with unique test identifiers. Spring's @Transactional can provide rollback for supported test setups. Testcontainers can provide a database per suite or class when that fits the build. A fresh connection alone does not isolate data in a shared schema.

11. What is the difference between @BeforeEach and @BeforeAll at the nested class level?

At the nested class level, @BeforeEach in the nested class runs after the outer class @BeforeEach but before the test methods in the nested class. The outer @BeforeEach is not replaced, it still fires for every test across all nested classes. Each nested class can have its own @BeforeEach that contributes to the setup for its tests. Similarly, @AfterEach in the nested class runs before the outer @AfterEach. @BeforeAll and @AfterAll at the nested class level only apply to tests within that nested class, not to the outer class tests.

12. How would you structure a test class for a repository with multiple operations?

Use nested classes to group tests by operation, with each nested class having its own setup relevant to that operation. For a CRUD repository, you might have an outer class with a shared connection, an @Nested class CreateTests with setup that produces an empty state, an @Nested class ReadTests with setup that populates known data, an @Nested class UpdateTests with setup that inserts a record to update, and a @Nested class DeleteTests with setup that inserts records to delete. Each nested class sets up only what its tests need, and the outer class provides common infrastructure. This makes the test structure mirror the actual operations and keeps setup code close to the tests that use it.

13. What are the limitations of @RepeatedTest compared to proper stress testing?

@RepeatedTest runs the same test method multiple times but does not isolate the iterations from each other. If iteration N modifies shared state, iteration N+1 sees that modified state. This means @RepeatedTest cannot catch intermittent failures caused by state coupling between iterations, and it cannot replace proper stress testing tools that reset state between runs. @RepeatedTest is useful for verifying that a single operation is idempotent or that a parser handles many variations of valid input consistently. For anything involving concurrent access, memory leaks under sustained load, or resource pool exhaustion, use dedicated stress testing tools instead.

14. What causes tests to pass in the IDE but fail in Maven or Gradle?

IDE and build-tool failures often point to different JUnit versions, engine dependencies, or runtime configuration. Confirm that Jupiter and Platform versions are aligned, then check resource paths and test discovery output. A non-static @BeforeAll also fails unless the class uses PER_CLASS.

15. How do you prevent extension registration from failing silently in multi-module projects?

Extensions registered via @ExtendWith in a base class are only inherited when that base class is on the classpath of the module containing the concrete tests. In multi-module projects, if the module dependency is missing, the extension never loads and the tests run without the setup logic. To catch this, add a logging assertion or static counter in the extension constructor and lifecycle methods, then verify those logs appear in CI output. You can also write a test that explicitly asserts the extension was instantiated. Another approach is to use auto-registration via junit-platform.properties or service loading instead of relying on inheritance from a base class.

16. What is the purpose of @Tag in JUnit 5 and when should you use it?

@Tag lets you label tests so they can be filtered during execution. This is useful in CI pipelines where you might want to run fast unit tests on every commit but reserve slower integration tests for certain triggers. Tags also help organise test reports, letting you see coverage by category like unit, integration, or database. To use tags, annotate test methods or classes with @Tag("category") and configure your build tool to include or exclude specific tags. Avoid putting business logic in tag names; use descriptive categories that reflect how you want to group test execution.

17. How does conditional test execution work in JUnit 5?

JUnit 5 supports conditional execution via annotations like @EnabledOnOs, @EnabledOnJre, @EnabledIf, and @DisabledIf. These let you enable or disable tests based on system properties, environment variables, or custom conditions. For custom conditions, implement ExecutionCondition and register it via @ExtendWith. Conditional execution is useful for platform-specific tests, tests that should only run on CI, or tests that depend on feature flags. Be careful not to abuse it for test logic that should be expressed as assertions; disabled tests still represent gaps in coverage.

18. What are the advantages of the Jupiter extension model over JUnit 4 rules?

JUnit 4 rules required wrapping test methods in a Statement and implementing TestRule, which was verbose and awkward for anything beyond simple setup/teardown. JUnit 5 extensions use callback interfaces like BeforeEachCallback and AfterAllCallback that integrate cleanly with the lifecycle without requiring you to wrap statements. Extensions can also participate in test parameter resolution, custom assertions via TestReporter, and dynamic test registration via TestFactory. The extension model is also more composable: multiple extensions can be registered on the same class and execute in a defined order without interfering with each other.

19. How do you write a @MethodSource factory for complex object parameters?

Return Stream<Arguments> from a factory and create one Arguments.of(...) value per invocation. Factories are static by default; PER_CLASS also allows an instance factory. For example: return Stream.of(Arguments.of(new Person("Alice", 30)), Arguments.of(new Person("Bob", 25))); Keep the input data independent between invocations.

20. Why is it important to clean up resources in @AfterAll rather than @AfterEach?

If you open a resource like a database connection or file handle in @BeforeAll, close it in @AfterAll exactly once. Using @AfterEach for teardown of shared resources is wrong because it runs after every test method, and closing a shared connection after the first test would cause subsequent tests to fail. The pattern is: @BeforeAll opens the resource once, @AfterAll closes it once, and @BeforeEach resets per-test state without touching the shared resource. For per-test resources, open and close in @BeforeEach and @AfterEach respectively.

Further Reading

Conclusion

JUnit Jupiter’s lifecycle methods separate class-scoped setup from per-test setup. The default is one instance per method; PER_CLASS enables instance-level @BeforeAll but also shares instance state. Use fresh mutable fixtures, group related cases with @Nested, and parameterize tests when the same assertions apply to each input.

For Spring Boot projects, check the test dependencies managed by the project before adding JUnit versions directly.

Category

Related Posts

Spring Boot Build Tools: Maven & Gradle

Configure Maven and Gradle for Spring Boot projects—plugins, dependency management, packaging JARs and WARs, and build automation essentials.

#spring-boot #spring-boot-roadmap #learning-path

Embedded Web Servers in Spring Boot: Tomcat, Jetty, Undertow

Configure embedded servers in Spring Boot: compare Tomcat, Jetty, and Undertow, tune thread pools, enable access logs, and switch implementations.

#spring-boot #spring-boot-roadmap #learning-path

Mockito: Mocking, Stubbing, Verifications, Spy vs Mock

Learn Mockito fundamentals: create mocks and spies, stub behavior with when().thenReturn(), verify interactions, and choose between Spy vs Mock wisely.

#spring-boot #spring-boot-roadmap #learning-path