testing-java
Java testing with JUnit 5 and Mockito: test lifecycle, mocking, and integration test patterns
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Java testing with JUnit 5 and Mockito: test lifecycle, mocking, and integration test patterns
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Architecture decisions: layering, design patterns, microservices trade-offs, and domain-driven design
Python architecture: PEP-8, type hints, clean layering, dependency injection, and testing strategy
General code review process: priority ordering, what to block on, how to give actionable feedback
Python data science: notebook structure, data validation, reproducibility, and model documentation
Git workflow: branch naming, conventional commits, PR conventions, and merge strategies
TypeScript refactoring: SOLID principles, DRY, type safety improvements, and eliminating code smells
| name | testing-java |
| description | Java testing with JUnit 5 and Mockito: test lifecycle, mocking, and integration test patterns |
@Test, @BeforeEach, @AfterEach, @ParameterizedTest).mvn test / gradle test@ExtendWith(MockitoExtension.class)
class OrderServiceTest {
@Mock
private PaymentGateway paymentGateway;
@InjectMocks
private OrderService orderService;
@Test
void shouldThrowOrderExceptionWhenPaymentFails() {
// Arrange
when(paymentGateway.charge(any())).thenThrow(new PaymentException("Declined"));
// Act & Assert
assertThrows(OrderException.class, () -> orderService.placeOrder(testOrder()));
}
}
@ParameterizedTest
@ValueSource(strings = {"", " ", "\t"})
void shouldReturnTrueForBlankStrings(String value) {
assertTrue(StringUtils.isBlank(value));
}
@Mock and @InjectMocks with MockitoExtension — avoid Mockito.mock() in tests.verify(paymentGateway, times(1)).charge(expectedAmount).@Captor to capture and assert arguments passed to mocks.@SpringBootTest for full context; @WebMvcTest for controller slice only.src/integrationTest/ and run in a separate Gradle task.gradle jacocoTestReport and enforce with jacocoTestCoverageVerification.