Tests
This commit is contained in:
parent
9489fe9140
commit
2aa6718424
2 changed files with 4 additions and 3 deletions
|
@ -6,7 +6,6 @@ import io.jsonwebtoken.SignatureAlgorithm;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Function;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -19,7 +18,6 @@ public class JWTTokenUtils {
|
|||
|
||||
/** The secret key used to encrypt all JWTs */
|
||||
@Value("${jwt.secret}")
|
||||
@Setter
|
||||
private String secret;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.mockito.InjectMocks;
|
|||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
@ExtendWith({MockitoExtension.class})
|
||||
public class JWTTokenUtilsTests {
|
||||
|
@ -18,7 +19,9 @@ public class JWTTokenUtilsTests {
|
|||
|
||||
@Test
|
||||
public void testGenerateToken() {
|
||||
utils.setSecret(
|
||||
ReflectionTestUtils.setField(
|
||||
utils,
|
||||
"secret",
|
||||
"One, seven, three, four, six, seven\n"
|
||||
+ "Three, two, one, four, seven, six, charlie, three\n"
|
||||
+ "Two, seven, eight, nine, seven, seven, seven\n"
|
||||
|
|
Loading…
Reference in a new issue