fix
This commit is contained in:
parent
22ccd24f77
commit
33e2bddf92
@ -8,6 +8,7 @@ import com.lk.paopao.security.JwtUtils;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
@ -37,17 +38,14 @@ class AuthServiceTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private JwtUtils mockJwtUtils;
|
private JwtUtils mockJwtUtils;
|
||||||
|
|
||||||
|
@InjectMocks
|
||||||
private AuthService authServiceUnderTest;
|
private AuthService authServiceUnderTest;
|
||||||
|
|
||||||
String TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjEwMDA2NiwidXNlcm5hbWUiOiJ4eXoiLCJpc3MiOiI4ZGNlMGM3NjcyMWFkODFiYzQxMjRhMDhjMTBkNDk3MSIsImV4cCI6MTcxNzYzODgxMn0.TdAMHh4n7SQVipXK-_zRsk5jhCVpoZI4jnlUIR7iO-I";
|
String TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjEwMDA2NiwidXNlcm5hbWUiOiJ4eXoiLCJpc3MiOiI4ZGNlMGM3NjcyMWFkODFiYzQxMjRhMDhjMTBkNDk3MSIsImV4cCI6MTcxNzYzODgxMn0.TdAMHh4n7SQVipXK-_zRsk5jhCVpoZI4jnlUIR7iO-I";
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
authServiceUnderTest = new AuthService();
|
|
||||||
ReflectionTestUtils.setField(authServiceUnderTest, "DEFAULT_HEAD_ICON", "avatar");
|
ReflectionTestUtils.setField(authServiceUnderTest, "DEFAULT_HEAD_ICON", "avatar");
|
||||||
authServiceUnderTest.userRepository = mockUserRepository;
|
|
||||||
authServiceUnderTest.authenticationManager = mockAuthenticationManager;
|
|
||||||
authServiceUnderTest.encoder = mockEncoder;
|
|
||||||
authServiceUnderTest.jwtUtils = mockJwtUtils;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user