diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/config/JWTTokenUtils.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/config/JWTTokenUtils.java index 0457a51..78e5e5e 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/config/JWTTokenUtils.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/config/JWTTokenUtils.java @@ -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; /** diff --git a/src/test/java/ch/usi/inf/sa4/sanmarinoes/smarthut/config/JWTTokenUtilsTests.java b/src/test/java/ch/usi/inf/sa4/sanmarinoes/smarthut/config/JWTTokenUtilsTests.java index 0f2a6da..ecc00b0 100644 --- a/src/test/java/ch/usi/inf/sa4/sanmarinoes/smarthut/config/JWTTokenUtilsTests.java +++ b/src/test/java/ch/usi/inf/sa4/sanmarinoes/smarthut/config/JWTTokenUtilsTests.java @@ -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"