mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-12 11:13:11 +08:00
fix: use doNothing for void Panache persist() in verification test example
Panache persist() returns void, so when().thenReturn() won't compile. Replaced with doNothing().when().persist() which is the correct Mockito pattern for void methods.
This commit is contained in:
@@ -83,11 +83,9 @@ class UserServiceTest {
|
||||
@Test
|
||||
void createUser_validInput_returnsUser() {
|
||||
var dto = new CreateUserDto("Alice", "alice@example.com");
|
||||
var expected = new User();
|
||||
expected.id = 1L;
|
||||
expected.name = dto.name();
|
||||
|
||||
when(userRepository.persist(any(User.class))).thenReturn(expected);
|
||||
|
||||
// Panache persist() void döndürür — doNothing + verify kullanın
|
||||
doNothing().when(userRepository).persist(any(User.class));
|
||||
|
||||
User result = userService.create(dto);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user