Merge branch 'tests' into 'dev'
Tests See merge request sa4-2020/the-sanmarinoes/backend!203
This commit is contained in:
commit
101f8a9398
2 changed files with 4 additions and 3 deletions
|
@ -6,7 +6,6 @@ import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import lombok.Setter;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -19,7 +18,6 @@ public class JWTTokenUtils {
|
||||||
|
|
||||||
/** The secret key used to encrypt all JWTs */
|
/** The secret key used to encrypt all JWTs */
|
||||||
@Value("${jwt.secret}")
|
@Value("${jwt.secret}")
|
||||||
@Setter
|
|
||||||
private String secret;
|
private String secret;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.test.util.ReflectionTestUtils;
|
||||||
|
|
||||||
@ExtendWith({MockitoExtension.class})
|
@ExtendWith({MockitoExtension.class})
|
||||||
public class JWTTokenUtilsTests {
|
public class JWTTokenUtilsTests {
|
||||||
|
@ -18,7 +19,9 @@ public class JWTTokenUtilsTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateToken() {
|
public void testGenerateToken() {
|
||||||
utils.setSecret(
|
ReflectionTestUtils.setField(
|
||||||
|
utils,
|
||||||
|
"secret",
|
||||||
"One, seven, three, four, six, seven\n"
|
"One, seven, three, four, six, seven\n"
|
||||||
+ "Three, two, one, four, seven, six, charlie, three\n"
|
+ "Three, two, one, four, seven, six, charlie, three\n"
|
||||||
+ "Two, seven, eight, nine, seven, seven, seven\n"
|
+ "Two, seven, eight, nine, seven, seven, seven\n"
|
||||||
|
|
Loading…
Reference in a new issue