Skip to content
Snippets Groups Projects
Commit caeef853 authored by Mingyuan Chen's avatar Mingyuan Chen
Browse files

删除SuperAdminServiceJuintTest.java

parent 29eba96f
Branches
No related tags found
No related merge requests found
package com.cardiff.wylTest;
import com.cardiff.client_project.mapper.SuperAdminMapper;
import com.cardiff.client_project.pojo.vo.AdminVO;
import com.cardiff.client_project.service.imp.SuperAdminServiceImp;
import com.cardiff.client_project.utils.Result;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;
class SuperAdminServiceJuintTest {
@Mock
private SuperAdminMapper superAdminMapper;
@InjectMocks
private SuperAdminServiceImp superAdminService; // 假设你的类名是 SuperAdminService
@BeforeEach
void setUp() {
MockitoAnnotations.openMocks(this);
}
@Test
void testSelectAllAdmin() {
// Arrange: Prepare mock data
AdminVO admin1 = new AdminVO();
admin1.setId(1);
admin1.setName("Admin_A");
admin1.setStatus(1);
List<AdminVO> mockAdmins = Arrays.asList(admin1);
// Mock superAdminMapper behavior
when(superAdminMapper.selectAllAdmin()).thenReturn(mockAdmins);
// Act: Call the method
Result result = superAdminService.selectAllAdmin();
// Assert: Verify the result
List<AdminVO> adminVOS = (List<AdminVO>) result.getData();
assertEquals(1, adminVOS.size());
assertEquals("Admin_A", adminVOS.get(0).getName());
assertEquals("ACTIVE", adminVOS.get(0).getStatus_str());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment