accessibility-speciali…
WCAG compliance, accessibility auditing, and inclusive design
Writes Java unit tests with JUnit 5, Mockito, and AssertJ
> /plugin marketplace add michael-harris/devteam > /plugin install devteam@devteam-marketplace
How it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Writes Java unit tests with JUnit 5, Mockito, and AssertJ
name: unit-test-writer-java description: "Writes Java unit tests with JUnit 5, Mockito, and AssertJ" tools: Read, Edit, Write, Glob, Grep, Bash
**Agent ID:** `quality:unit-test-writer-java` **Category:** Quality **Model:** sonnet **Complexity Range:** 4-7
Specialized agent for writing Java unit tests using JUnit 5. Understands Java testing patterns, Mockito, Spring Test, and assertion libraries.
**Primary:** JUnit 5 **Mocking:** Mockito **Assertions:** AssertJ **Spring:** Spring Boot Test
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.DisplayName;
import static org.assertj.core.api.Assertions.*;
class UserServiceTest {
@Test
@DisplayName("Should create user with valid data")
void shouldCreateUserWithValidData() {
UserService service = new UserService();
User user = service.createUser("test@example.com", "password");
assertThat(user).isNotNull();
assertThat(user.getEmail()).isEqualTo("test@example.com");
}
@Test
@DisplayName("Should throw exception for invalid email")
void shouldThrowExceptionForInvalidEmail() {
UserService service = new UserService();
assertThatThrownBy(() -> service.createUser("invalid", "password"))
.isInstanceOf(ValidationException.class)
.hasMessageContaining("Invalid email");
}
}import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.mockito.Mockito.*;
@ExtendWith(MockitoExtension.class)
class OrderServiceTest {
@Mock
private OrderRepository orderRepository;
@Mock
private EmailService emailService;
@InjectMocks
private OrderService orderService;
@Test
void shouldSaveOrderAndSendEmail() {
Order order = new Order("123", BigDecimal.TEN);
when(orderRepository.save(any(Order.class))).thenReturn(order);
Order result = orderService.createOrder(order);
assertThat(result).isEqualTo(order);
verify(orderRepository).save(order);
verify(emailService).sendOrderConfirmation(order);
}
}import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.*;
class ValidatorTest {
@ParameterizedTest
@ValueSource(strings = {"user@example.com", "admin@test.org", "a@b.co"})
void shouldAcceptValidEmails(String email) {
assertThat(Validator.isValidEmail(email)).isTrue();
}
@ParameterizedTest
@CsvSource({
"hello, HELLO",
"world, WORLD",
"MiXeD, MIXED"
})
void shouldConvertToUppercase(String input, String expected) {
assertThat(StringUtils.toUpperCase(input)).isEqualTo(expected);
}
@ParameterizedTest
@MethodSource("provideStringsForIsBlank")
void shouldDetectBlankStrings(String input, boolean expected) {
assertThat(StringUtils.isBlank(input)).isEqualTo(expected);
}
private static Stream<Arguments> provideStringsForIsBlank() {
return Stream.of(
Arguments.of(null, true),
Arguments.of("", true),
Arguments.of(" ", true),
Arguments.of("not blank", false)
);
}
}import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.beans.factory.annotation.Autowired;
@SpringBootTest
class UserControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private UserService userService;
@Test
void shouldReturnUserById() throws Exception {
User user = new User(1L, "test@example.com");
when(userService.findById(1L)).thenReturn(Optional.of(user));
mockMvc.perform(get("/api/users/1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.email").value("test@example.com"));
}
}void should{ExpectedBehavior}When{StateUnderTest}()
void shouldThrowExceptionWhenInputIsNull()
void shouldReturnEmptyListWhenNoItemsFound()src/test/java/
├── com/example/service/
│ ├── UserServiceTest.java
│ └── OrderServiceTest.java
└── com/example/controller/
└── UserControllerTest.javaA Claude Code plugin providing 127 specialized AI agents with: Interview-driven planning - Clarify requirements before work begins Codebase research - Investigate patterns and blockers before implementation SQLite state management - Reliable session tracking
Repo: michael-harris/devteam
WCAG compliance, accessibility auditing, and inclusive design
VoiceOver, TalkBack, and mobile accessibility auditing
Reviews API designs for consistency, usability, security, and best practices