{"id":"b99507d1-46cd-4edd-9c01-618786450943","shortId":"MaAZB6","kind":"skill","title":"Java Junit","tagline":"Awesome Copilot skill by Github","description":"# JUnit 5+ Best Practices\n\nYour goal is to help me write effective unit tests with JUnit 5, covering both standard and data-driven testing approaches.\n\n## Project Setup\n\n- Use a standard Maven or Gradle project structure.\n- Place test source code in `src/test/java`.\n- Include dependencies for `junit-jupiter-api`, `junit-jupiter-engine`, and `junit-jupiter-params` for parameterized tests.\n- Use build tool commands to run tests: `mvn test` or `gradle test`.\n\n## Test Structure\n\n- Test classes should have a `Test` suffix, e.g., `CalculatorTest` for a `Calculator` class.\n- Use `@Test` for test methods.\n- Follow the Arrange-Act-Assert (AAA) pattern.\n- Name tests using a descriptive convention, like `methodName_should_expectedBehavior_when_scenario`.\n- Use `@BeforeEach` and `@AfterEach` for per-test setup and teardown.\n- Use `@BeforeAll` and `@AfterAll` for per-class setup and teardown (must be static methods).\n- Use `@DisplayName` to provide a human-readable name for test classes and methods.\n\n## Standard Tests\n\n- Keep tests focused on a single behavior.\n- Avoid testing multiple conditions in one test method.\n- Make tests independent and idempotent (can run in any order).\n- Avoid test interdependencies.\n\n## Data-Driven (Parameterized) Tests\n\n- Use `@ParameterizedTest` to mark a method as a parameterized test.\n- Use `@ValueSource` for simple literal values (strings, ints, etc.).\n- Use `@MethodSource` to refer to a factory method that provides test arguments as a `Stream`, `Collection`, etc.\n- Use `@CsvSource` for inline comma-separated values.\n- Use `@CsvFileSource` to use a CSV file from the classpath.\n- Use `@EnumSource` to use enum constants.\n\n## Assertions\n\n- Use the static methods from `org.junit.jupiter.api.Assertions` (e.g., `assertEquals`, `assertTrue`, `assertNotNull`).\n- For more fluent and readable assertions, consider using a library like AssertJ (`assertThat(...).is...`).\n- Use `assertThrows` or `assertDoesNotThrow` to test for exceptions.\n- Group related assertions with `assertAll` to ensure all assertions are checked before the test fails.\n- Use descriptive messages in assertions to provide clarity on failure.\n\n## Mocking and Isolation\n\n- Use a mocking framework like Mockito to create mock objects for dependencies.\n- Use `@Mock` and `@InjectMocks` annotations from Mockito to simplify mock creation and injection.\n- Use interfaces to facilitate mocking.\n\n## Test Organization\n\n- Group tests by feature or component using packages.\n- Use `@Tag` to categorize tests (e.g., `@Tag(\"fast\")`, `@Tag(\"integration\")`).\n- Use `@TestMethodOrder(MethodOrderer.OrderAnnotation.class)` and `@Order` to control test execution order when strictly necessary.\n- Use `@Disabled` to temporarily skip a test method or class, providing a reason.\n- Use `@Nested` to group tests in a nested inner class for better organization and structure.","tags":["java","junit","awesome","copilot","github"],"capabilities":["skill","source-github","category-awesome-copilot"],"categories":["awesome-copilot"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/github/awesome-copilot/java-junit","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"install_from":"skills.sh"}},"qualityScore":"0.300","qualityRationale":"deterministic score 0.30 from registry signals: · indexed on skills.sh · published under github/awesome-copilot","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T17:40:17.530Z","embedding":null,"createdAt":"2026-04-18T20:25:30.547Z","updatedAt":"2026-04-22T17:40:17.530Z","lastSeenAt":"2026-04-22T17:40:17.530Z","tsv":"'5':9,24 'aaa':107 'act':105 'afteral':135 'aftereach':124 'annot':333 'api':56 'approach':33 'argument':226 'arrang':104 'arrange-act-assert':103 'assert':106,256,272,291,297,308 'assertal':293 'assertdoesnotthrow':284 'assertequ':264 'assertj':278 'assertnotnul':266 'assertthat':279 'assertthrow':282 'asserttru':265 'avoid':170,188 'awesom':3 'beforeal':133 'beforeeach':122 'behavior':169 'best':10 'better':404 'build':70 'calcul':94 'calculatortest':91 'categor':360 'category-awesome-copilot' 'check':299 'clariti':311 'class':84,95,139,158,389,402 'classpath':249 'code':47 'collect':230 'comma':237 'comma-separ':236 'command':72 'compon':354 'condit':173 'consid':273 'constant':255 'control':373 'convent':114 'copilot':4 'cover':25 'creat':324 'creation':339 'csv':245 'csvfilesourc':241 'csvsourc':233 'data':30,192 'data-driven':29,191 'depend':51,328 'descript':113,305 'disabl':381 'displaynam':148 'driven':31,193 'e.g':90,263,362 'effect':19 'engin':60 'ensur':295 'enum':254 'enumsourc':251 'etc':214,231 'except':288 'execut':375 'expectedbehavior':118 'facilit':345 'factori':221 'fail':303 'failur':313 'fast':364 'featur':352 'file':246 'fluent':269 'focus':165 'follow':101 'framework':320 'github':7 'goal':13 'gradl':41,79 'group':289,349,396 'help':16 'human':153 'human-read':152 'idempot':182 'includ':50 'independ':180 'inject':341 'injectmock':332 'inlin':235 'inner':401 'int':213 'integr':366 'interdepend':190 'interfac':343 'isol':316 'java':1 'junit':2,8,23,54,58,63 'junit-jupiter-api':53 'junit-jupiter-engin':57 'junit-jupiter-param':62 'jupit':55,59,64 'keep':163 'librari':276 'like':115,277,321 'liter':210 'make':178 'mark':199 'maven':39 'messag':306 'method':100,146,160,177,201,222,260,387 'methodnam':116 'methodorderer.orderannotation.class':369 'methodsourc':216 'mock':314,319,325,330,338,346 'mockito':322,335 'multipl':172 'must':143 'mvn':76 'name':109,155 'necessari':379 'nest':394,400 'object':326 'one':175 'order':187,371,376 'org.junit.jupiter.api.assertions':262 'organ':348,405 'packag':356 'param':65 'parameter':67,194,204 'parameterizedtest':197 'pattern':108 'per':127,138 'per-class':137 'per-test':126 'place':44 'practic':11 'project':34,42 'provid':150,224,310,390 'readabl':154,271 'reason':392 'refer':218 'relat':290 'run':74,184 'scenario':120 'separ':238 'setup':35,129,140 'simpl':209 'simplifi':337 'singl':168 'skill':5 'skip':384 'sourc':46 'source-github' 'src/test/java':49 'standard':27,38,161 'static':145,259 'stream':229 'strict':378 'string':212 'structur':43,82,407 'suffix':89 'tag':358,363,365 'teardown':131,142 'temporarili':383 'test':21,32,45,68,75,77,80,81,83,88,97,99,110,128,157,162,164,171,176,179,189,195,205,225,286,302,347,350,361,374,386,397 'testmethodord':368 'tool':71 'unit':20 'use':36,69,96,111,121,132,147,196,206,215,232,240,243,250,253,257,274,281,304,317,329,342,355,357,367,380,393 'valu':211,239 'valuesourc':207 'write':18","prices":[{"id":"d414474e-5f85-4392-a31a-b73e96425c34","listingId":"b99507d1-46cd-4edd-9c01-618786450943","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"github","category":"awesome-copilot","install_from":"skills.sh"},"createdAt":"2026-04-18T20:25:30.547Z"}],"sources":[{"listingId":"b99507d1-46cd-4edd-9c01-618786450943","source":"github","sourceId":"github/awesome-copilot/java-junit","sourceUrl":"https://github.com/github/awesome-copilot/tree/main/skills/java-junit","isPrimary":false,"firstSeenAt":"2026-04-18T21:49:55.722Z","lastSeenAt":"2026-04-22T12:52:15.588Z"},{"listingId":"b99507d1-46cd-4edd-9c01-618786450943","source":"skills_sh","sourceId":"github/awesome-copilot/java-junit","sourceUrl":"https://skills.sh/github/awesome-copilot/java-junit","isPrimary":true,"firstSeenAt":"2026-04-18T20:25:30.547Z","lastSeenAt":"2026-04-22T17:40:17.530Z"}],"details":{"listingId":"b99507d1-46cd-4edd-9c01-618786450943","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"github","slug":"java-junit","source":"skills_sh","category":"awesome-copilot","skills_sh_url":"https://skills.sh/github/awesome-copilot/java-junit"},"updatedAt":"2026-04-22T17:40:17.530Z"}}