From 292037689feba51ab48be1bb1bb0dc534bda1ad9 Mon Sep 17 00:00:00 2001
From: KronosDP <darrel.danadyaksa19@gmail.com>
Date: Fri, 28 Feb 2025 21:16:52 +0700
Subject: [PATCH] [REFACTOR] Simplify Mockito argument matchers in
 AuthenticationControllerTest

---
 .../controller/AuthenticationControllerTest.java      | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/test/java/com/safetypin/authentication/controller/AuthenticationControllerTest.java b/src/test/java/com/safetypin/authentication/controller/AuthenticationControllerTest.java
index f0de3fd..6ecff60 100644
--- a/src/test/java/com/safetypin/authentication/controller/AuthenticationControllerTest.java
+++ b/src/test/java/com/safetypin/authentication/controller/AuthenticationControllerTest.java
@@ -22,7 +22,6 @@ import org.springframework.test.web.servlet.MockMvc;
 import java.time.LocalDate;
 
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@@ -129,7 +128,7 @@ class AuthenticationControllerTest {
         user.setSocialId(null);
 
         user.setId(1L);
-        Mockito.when(authenticationService.loginUser(eq("email@example.com"), eq("password"))).thenReturn(user);
+        Mockito.when(authenticationService.loginUser("email@example.com", "password")).thenReturn(user);
 
         mockMvc.perform(post("/api/auth/login-email")
                         .param("email", "email@example.com")
@@ -151,7 +150,7 @@ class AuthenticationControllerTest {
         user.setProvider("GOOGLE");
         user.setSocialId("social123");
         user.setId(2L);
-        Mockito.when(authenticationService.loginSocial(eq("social@example.com"))).thenReturn(user);
+        Mockito.when(authenticationService.loginSocial("social@example.com")).thenReturn(user);
 
         mockMvc.perform(post("/api/auth/login-social")
                         .param("email", "social@example.com"))
@@ -162,7 +161,7 @@ class AuthenticationControllerTest {
 
     @Test
     void testVerifyOTP_Success() throws Exception {
-        Mockito.when(authenticationService.verifyOTP(eq("email@example.com"), eq("123456"))).thenReturn(true);
+        Mockito.when(authenticationService.verifyOTP("email@example.com", "123456")).thenReturn(true);
 
         mockMvc.perform(post("/api/auth/verify-otp")
                         .param("email", "email@example.com")
@@ -173,7 +172,7 @@ class AuthenticationControllerTest {
 
     @Test
     void testVerifyOTP_Failure() throws Exception {
-        Mockito.when(authenticationService.verifyOTP(eq("email@example.com"), eq("000000"))).thenReturn(false);
+        Mockito.when(authenticationService.verifyOTP("email@example.com", "000000")).thenReturn(false);
 
         mockMvc.perform(post("/api/auth/verify-otp")
                         .param("email", "email@example.com")
@@ -198,7 +197,7 @@ class AuthenticationControllerTest {
 
     @Test
     void testPostContent() throws Exception {
-        Mockito.when(authenticationService.postContent(eq("email@example.com"), eq("Test Content")))
+        Mockito.when(authenticationService.postContent("email@example.com", "Test Content"))
                 .thenReturn("Content posted successfully");
 
         mockMvc.perform(post("/api/auth/post")
-- 
GitLab