{"enrichment":{"faq":[{"a":"junit-5-skill teaches you to write JUnit 5 tests by marking test methods with @Test, using assertions like assertEquals and assertThrows, and organizing tests with @BeforeEach and @AfterEach lifecycle hooks. Start with a simple test class, add your test methods, and run via Maven or Gradle. The skill covers both basic unit tests and advanced patterns like parameterized tests and nested test classes for better organization.","q":"How to write JUnit 5 tests in Java?"},{"a":"junit-5-skill covers key JUnit 5 annotations including @Test, @BeforeEach, @AfterEach, @DisplayName, @Nested, and @ParameterizedTest. Best practices include using descriptive test names, organizing related tests in nested classes, leveraging @DisplayName for readable output, keeping tests focused and independent, and using parameterized tests to reduce duplication. The skill also teaches when to mock versus when to use real objects.","q":"What are JUnit 5 annotations and best practices?"},{"a":"junit-5-skill shows how to mock dependencies using Mockito by creating mock objects with Mockito.mock(), stubbing behavior with when().thenReturn(), and verifying method calls with verify(). You can inject mocks into your test class and configure them to return specific values or throw exceptions. The skill demonstrates common patterns like mocking external services, verifying interactions, and using argument matchers for flexible assertions.","q":"How do I mock dependencies in JUnit with Mockito?"},{"a":"junit-5-skill explains parameterized tests as a way to run the same test logic with multiple input sets, reducing code duplication. Use @ParameterizedTest with sources like @ValueSource, @CsvSource, or @MethodSource to provide test data. For example, @CsvSource lets you inline multiple test cases as CSV rows. This approach makes it easy to test edge cases and boundary conditions without writing separate test methods for each scenario.","q":"What are parameterized tests and how do I create them?"},{"a":"junit-5-skill teaches test organization using @Nested to group related tests into inner classes, improving readability and maintainability. Combine this with lifecycle hooks: @BeforeEach runs before each test, @BeforeAll runs once before all tests in a class, and @AfterEach/@AfterAll clean up afterward. Nested classes inherit parent lifecycle hooks, allowing you to set up shared context and keep tests logically grouped by feature or scenario.","q":"How do I organize tests with nested classes and lifecycle?"},{"a":"junit-5-skill covers JUnit 5 assertions including assertEquals, assertTrue, assertFalse, assertNull, assertThrows, and assertAll. Use assertThrows to verify that code throws an expected exception with a specific message. Use assertAll to group multiple assertions so all run even if one fails, giving you complete feedback. The skill also shows how to use custom assertion messages and lambda expressions for more expressive, maintainable tests.","q":"What assertions and exception testing does JUnit 5 provide?"}],"shadow_tags":["test-automation","assertion-library","mock-framework","test-organization","java-testing","tdd-patterns","ci-cd-ready","parameterization"],"summary_rewrite":"This skill equips you to write robust JUnit 5 tests in Java, from basic assertions and exception handling to parameterized test cases and Mockito-driven mocking. It covers lifecycle management, nested test organization, and anti-patterns to avoid, with quick reference commands for Maven and Gradle execution."},"files":[{"bytes":6480,"path":"junit-5-skill/SKILL.md","sha256":"0d9c7618a2412246486849d2a3f088291704eacacb702f48c91ec4ec71cfa126","url":"https://skillfed.io/files/LambdaTest/agent-skills/junit-5-skill/4562b517/SKILL.md"}],"id":"LambdaTest/agent-skills/junit-5-skill","links":{"html":"https://skillfed.io/LambdaTest/agent-skills/junit-5-skill","md":"https://skillfed.io/LambdaTest/agent-skills/junit-5-skill.md","repo":"https://github.com/LambdaTest/agent-skills"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":68,"language":"Python","last_updated":"2026-07-24","license":"MIT","name":"junit-5-skill","publisher":"LambdaTest","stars":339},"relations":{"similar":[{"id":"giuseppe-trisciuoglio/developer-kit/unit-test-parameterized"},{"id":"dawiddutoit/custom-claude/java-test-generator"},{"id":"decebals/claude-code-java/test-quality"},{"id":"josavicentevw/ai-agent-skills/testing"},{"id":"softspark/ai-toolkit/java-patterns"},{"id":"PracticalSwan/agent-skills/java-junit"},{"id":"LambdaTest/agent-skills/phpunit-skill"},{"id":"pluginagentmarketplace/custom-plugin-java/java-testing"},{"id":"personamanagmentlayer/pcl/java-expert"},{"id":"giuseppe-trisciuoglio/developer-kit/unit-test-bean-validation"}]},"slug":{"owner":"LambdaTest","repo":"agent-skills","skill":"junit-5-skill"},"version":"4562b517"}
