mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
Remove redundant key generation in tests
This commit is contained in:
@@ -14,7 +14,6 @@ import java.time.Clock;
|
||||
import java.time.Instant;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import static java.time.Duration.ofMinutes;
|
||||
import static java.time.temporal.ChronoUnit.SECONDS;
|
||||
@@ -23,6 +22,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static sonia.scm.security.SecureKeyTestUtil.createSecureKey;
|
||||
|
||||
@SubjectAware(
|
||||
username = "user",
|
||||
@@ -52,10 +52,7 @@ public class JwtAccessTokenRefresherTest {
|
||||
|
||||
@Before
|
||||
public void initKeyResolver() {
|
||||
byte[] bytes = new byte[256];
|
||||
new Random().nextBytes(bytes);
|
||||
SecureKey secureKey = new SecureKey(bytes, System.currentTimeMillis());
|
||||
when(keyResolver.getSecureKey(any())).thenReturn(secureKey);
|
||||
when(keyResolver.getSecureKey(any())).thenReturn(createSecureKey());
|
||||
|
||||
Clock creationClock = mock(Clock.class);
|
||||
when(creationClock.instant()).thenReturn(TOKEN_CREATION);
|
||||
|
||||
Reference in New Issue
Block a user