From 628de8727a85460e0c588204596b2d9de4848434 Mon Sep 17 00:00:00 2001
From: Martin Vogel <martin.vogel@sinc.de>
Date: Thu, 23 Jun 2022 11:44:47 +0200
Subject: [PATCH] #414 Finalize vars and reformat

---
 .../core}/auth/OAuthTokenIntegrationTest.java    | 16 ++++++++--------
 .../fitconnect/core}/crypto/HashUtilTest.java    | 14 +++++++-------
 .../core}/crypto/JWECryptoServiceTest.java       | 10 +++++-----
 3 files changed, 20 insertions(+), 20 deletions(-)
 rename core/src/test/java/{fitconnect/impl => de/fitko/fitconnect/core}/auth/OAuthTokenIntegrationTest.java (59%)
 rename core/src/test/java/{fitconnect/impl => de/fitko/fitconnect/core}/crypto/HashUtilTest.java (50%)
 rename core/src/test/java/{fitconnect/impl => de/fitko/fitconnect/core}/crypto/JWECryptoServiceTest.java (77%)

diff --git a/core/src/test/java/fitconnect/impl/auth/OAuthTokenIntegrationTest.java b/core/src/test/java/de/fitko/fitconnect/core/auth/OAuthTokenIntegrationTest.java
similarity index 59%
rename from core/src/test/java/fitconnect/impl/auth/OAuthTokenIntegrationTest.java
rename to core/src/test/java/de/fitko/fitconnect/core/auth/OAuthTokenIntegrationTest.java
index e188eb2a8..6dacd8422 100644
--- a/core/src/test/java/fitconnect/impl/auth/OAuthTokenIntegrationTest.java
+++ b/core/src/test/java/de/fitko/fitconnect/core/auth/OAuthTokenIntegrationTest.java
@@ -1,4 +1,4 @@
-package fitconnect.impl.auth;
+package de.fitko.fitconnect.core.auth;
 
 import de.fitko.fitconnect.api.domain.auth.OAuthToken;
 import de.fitko.fitconnect.api.services.Sender;
@@ -17,17 +17,17 @@ class OAuthTokenIntegrationTest {
     void retrieveAuthenticationToken() {
 
         // Given
-        var tokenUrl = "https://auth-testing.fit-connect.fitko.dev/token";
-        var clientId = "781f6213-0f0f-4a79-9372-e7187ffda98b";
-        var secret = "PnzR8Vbmhpv_VwTkT34wponqXWK8WBm-LADlryYdV4o";
-        var scope1 = "send:region:DE";
-        var scope2 = "send:region:EN";
+        final var tokenUrl = "https://auth-testing.fit-connect.fitko.dev/token";
+        final var clientId = "781f6213-0f0f-4a79-9372-e7187ffda98b";
+        final var secret = "PnzR8Vbmhpv_VwTkT34wponqXWK8WBm-LADlryYdV4o";
+        final var scope1 = "send:region:DE";
+        final var scope2 = "send:region:EN";
 
-        var authService = new DefaultOAuthService( new RestTemplate(), tokenUrl);
+        final var authService = new DefaultOAuthService(new RestTemplate(), tokenUrl);
         final Sender sender = new SubmissionSender(authService, null, null, null);
 
         // When
-        OAuthToken token = sender.retrieveOAuthToken(clientId, secret, scope1,scope2);
+        final OAuthToken token = sender.retrieveOAuthToken(clientId, secret, scope1, scope2);
 
         // Then
         assertNotNull(token);
diff --git a/core/src/test/java/fitconnect/impl/crypto/HashUtilTest.java b/core/src/test/java/de/fitko/fitconnect/core/crypto/HashUtilTest.java
similarity index 50%
rename from core/src/test/java/fitconnect/impl/crypto/HashUtilTest.java
rename to core/src/test/java/de/fitko/fitconnect/core/crypto/HashUtilTest.java
index 80276f7c9..4781501d4 100644
--- a/core/src/test/java/fitconnect/impl/crypto/HashUtilTest.java
+++ b/core/src/test/java/de/fitko/fitconnect/core/crypto/HashUtilTest.java
@@ -1,4 +1,4 @@
-package fitconnect.impl.crypto;
+package de.fitko.fitconnect.core.crypto;
 
 import de.fitko.fitconnect.core.crypto.HashUtil;
 import org.junit.jupiter.api.Test;
@@ -14,13 +14,13 @@ class HashUtilTest {
     @Test
     public void testMessageDigestForDataAndAttachments() throws IOException {
 
-            // Given (sender creates hash of (Fachdaten) or attachments (Anhänge))
-            byte[] exampleFileContent = getExampleFileContent("/example.pdf");
-            byte[] hashFromSender = underTest.createHash(exampleFileContent);
+        // Given (sender creates hash of (Fachdaten) or attachments (Anhänge))
+        final byte[] exampleFileContent = getExampleFileContent("/example.pdf");
+        final byte[] hashFromSender = underTest.createHash(exampleFileContent);
 
-            // When (subscriber verifies hash of data or attachments)
-            boolean verificationResult = underTest.verify(hashFromSender, exampleFileContent);
-            assertTrue(verificationResult);
+        // When (subscriber verifies hash of data or attachments)
+        final boolean verificationResult = underTest.verify(hashFromSender, exampleFileContent);
+        assertTrue(verificationResult);
     }
 
     private byte[] getExampleFileContent(final String path) throws IOException {
diff --git a/core/src/test/java/fitconnect/impl/crypto/JWECryptoServiceTest.java b/core/src/test/java/de/fitko/fitconnect/core/crypto/JWECryptoServiceTest.java
similarity index 77%
rename from core/src/test/java/fitconnect/impl/crypto/JWECryptoServiceTest.java
rename to core/src/test/java/de/fitko/fitconnect/core/crypto/JWECryptoServiceTest.java
index 47bc453e5..078212522 100644
--- a/core/src/test/java/fitconnect/impl/crypto/JWECryptoServiceTest.java
+++ b/core/src/test/java/de/fitko/fitconnect/core/crypto/JWECryptoServiceTest.java
@@ -1,4 +1,4 @@
-package fitconnect.impl.crypto;
+package de.fitko.fitconnect.core.crypto;
 
 import com.nimbusds.jose.JOSEException;
 import com.nimbusds.jose.jwk.KeyUse;
@@ -24,7 +24,7 @@ class JWECryptoServiceTest {
         final RSAKey publicKey = privateKey.toPublicJWK();
 
         // When
-        String encryptedData = underTest.encryptString(publicKey, "some foo");
+        final String encryptedData = underTest.encryptString(publicKey, "some foo");
 
         // Then
         assertNotNull(encryptedData);
@@ -37,17 +37,17 @@ class JWECryptoServiceTest {
         // Given
         final RSAKey privateKey = generateRsaKey(4096);
         final RSAKey publicKey = privateKey.toPublicJWK();
-        String encryptedData = underTest.encryptString(publicKey, "some foo");
+        final String encryptedData = underTest.encryptString(publicKey, "some foo");
 
         // When
-        String decrypted = underTest.decryptString(privateKey, encryptedData);
+        final String decrypted = underTest.decryptString(privateKey, encryptedData);
 
         // Then
         assertNotNull(decrypted);
         assertEquals("some foo", decrypted);
     }
 
-    public static RSAKey generateRsaKey(int size) throws JOSEException {
+    public static RSAKey generateRsaKey(final int size) throws JOSEException {
         return new RSAKeyGenerator(size)
                 .keyUse(KeyUse.ENCRYPTION)
                 .keyID(UUID.randomUUID().toString())
-- 
GitLab