Socekt server

This commit is contained in:
clinton committed 2026-04-06 13:48:43 +02:00
1 parent c751f4c5e7
commit 7b70be5e6e
11 files changed
+1201 -52

No files matched your search

@@ -1,44 +0,0 @@
package za.co.rootbranch.coffeechat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import za.co.rootbranch.coffeechat.models.User;
import za.co.rootbranch.coffeechat.repositories.UserRepository;
import za.co.rootbranch.coffeechat.services.UserService;
@ExtendWith(MockitoExtension.class)
public class CreateUserTest {
@Mock
private UserRepository userRepository;
@InjectMocks
private UserService userService;
@BeforeEach()
void init() {
// do setup
}
@Test
void TestCreateANewUser() {
// Mock the behavior of the repository
String email = "test@example.com";
User mockUser = new User(null,"", "", email);
when(userRepository.findByEmail(email)).thenReturn(mockUser); // Stub the method call
// Call the service method
User foundUser = userService.findUserByEmail(email);
// Verify the result using JUnit assertions
assertEquals(email, foundUser.getEmail());
}
}