Merge branch 'tests' into 'dev'

Tests

See merge request sa4-2020/the-sanmarinoes/backend!203
This commit is contained in:
Claudio Maggioni 2020-05-27 11:43:19 +02:00
commit 101f8a9398
2 changed files with 4 additions and 3 deletions

View file

@ -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;
/**

View file

@ -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"