From 7c6908f9a7448dbc787e1afe505c49370f5f6671 Mon Sep 17 00:00:00 2001 From: Marc Gomez Date: Thu, 28 Jul 2022 15:02:02 +0200 Subject: [PATCH] chore: reduce visibility of test fields (#14) * Identity Hub CLI * Add test for buildSignedJwt * Rename test util class for CLI * Consolidate test * Remove unused import * Checkstyle * Make test fields private * Reduce visibility of util class * Checkstyle * Make static variables final --- .../identityhub/cli/CliTestUtils.java | 5 +- .../cli/VerifiableCredentialsCommandTest.java | 33 ++++---- .../DidJwtCredentialsVerifierTest.java | 79 +++++++++---------- .../IdentityHubCredentialsVerifierTest.java | 33 ++++---- .../CollectionsWriteProcessorTest.java | 2 - .../IdentityHubClientImplIntegrationTest.java | 2 +- .../VerifiableCredentialsJwtServiceTest.java | 14 ++-- .../VerifiableCredentialsIntegrationTest.java | 20 ++--- 8 files changed, 90 insertions(+), 98 deletions(-) diff --git a/client-cli/src/test/java/org/eclipse/dataspaceconnector/identityhub/cli/CliTestUtils.java b/client-cli/src/test/java/org/eclipse/dataspaceconnector/identityhub/cli/CliTestUtils.java index 0a6c75381..a68bc991f 100644 --- a/client-cli/src/test/java/org/eclipse/dataspaceconnector/identityhub/cli/CliTestUtils.java +++ b/client-cli/src/test/java/org/eclipse/dataspaceconnector/identityhub/cli/CliTestUtils.java @@ -29,13 +29,12 @@ import static org.eclipse.dataspaceconnector.identityhub.credentials.CryptoUtils.readPrivateEcKey; import static org.eclipse.dataspaceconnector.identityhub.credentials.CryptoUtils.readPublicEcKey; - -public class CliTestUtils { - static final Faker FAKER = new Faker(); +class CliTestUtils { public static final String PUBLIC_KEY_PATH = "src/test/resources/test-public-key.pem"; public static final String PRIVATE_KEY_PATH = "src/test/resources/test-private-key.pem"; public static final PublicKeyWrapper PUBLIC_KEY; public static final PrivateKeyWrapper PRIVATE_KEY; + private static final Faker FAKER = new Faker(); private static final VerifiableCredentialsJwtService VC_JWT_SERVICE = new VerifiableCredentialsJwtServiceImpl(new ObjectMapper()); static { diff --git a/client-cli/src/test/java/org/eclipse/dataspaceconnector/identityhub/cli/VerifiableCredentialsCommandTest.java b/client-cli/src/test/java/org/eclipse/dataspaceconnector/identityhub/cli/VerifiableCredentialsCommandTest.java index fab4765ea..70ce5a265 100644 --- a/client-cli/src/test/java/org/eclipse/dataspaceconnector/identityhub/cli/VerifiableCredentialsCommandTest.java +++ b/client-cli/src/test/java/org/eclipse/dataspaceconnector/identityhub/cli/VerifiableCredentialsCommandTest.java @@ -49,27 +49,24 @@ class VerifiableCredentialsCommandTest { - static final Faker FAKER = new Faker(); - static final ObjectMapper MAPPER = new ObjectMapper(); - - static final VerifiableCredential VC1 = createVerifiableCredential(); - static final SignedJWT SIGNED_VC1 = signVerifiableCredential(VC1); - - static final VerifiableCredential VC2 = createVerifiableCredential(); - static final SignedJWT SIGNED_VC2 = signVerifiableCredential(VC2); - - String hubUrl = FAKER.internet().url(); - - IdentityHubCli app = new IdentityHubCli(); - CommandLine cmd = new CommandLine(app); - StringWriter out = new StringWriter(); - StringWriter err = new StringWriter(); + private static final Faker FAKER = new Faker(); + private static final ObjectMapper MAPPER = new ObjectMapper(); + private static final VerifiableCredential VC1 = createVerifiableCredential(); + private static final SignedJWT SIGNED_VC1 = signVerifiableCredential(VC1); + private static final VerifiableCredential VC2 = createVerifiableCredential(); + private static final SignedJWT SIGNED_VC2 = signVerifiableCredential(VC2); + private static final String HUB_URL = FAKER.internet().url(); + + private IdentityHubCli app = new IdentityHubCli(); + private CommandLine cmd = new CommandLine(app); + private StringWriter out = new StringWriter(); + private StringWriter err = new StringWriter(); @BeforeEach void setUp() { app.identityHubClient = mock(IdentityHubClient.class); app.verifiableCredentialsJwtService = new VerifiableCredentialsJwtServiceImpl(new ObjectMapper()); - app.hubUrl = hubUrl; + app.hubUrl = HUB_URL; cmd.setOut(new PrintWriter(out)); cmd.setErr(new PrintWriter(err)); } @@ -160,10 +157,10 @@ void add_invalidPrivateKey_fails() throws JsonProcessingException { } private int executeList() { - return cmd.execute("-s", hubUrl, "vc", "list"); + return cmd.execute("-s", HUB_URL, "vc", "list"); } private int executeAdd(String json, String privateKey) { - return cmd.execute("-s", hubUrl, "vc", "add", "-c", json, "-i", "identity-hub-test-issuer", "-b", "identity-hub-test-subject", "-k", privateKey); + return cmd.execute("-s", HUB_URL, "vc", "add", "-c", json, "-i", "identity-hub-test-issuer", "-b", "identity-hub-test-subject", "-k", privateKey); } } \ No newline at end of file diff --git a/extensions/identity-hub-verifier/src/test/java/org/eclipse/dataspaceconnector/identityhub/verifier/DidJwtCredentialsVerifierTest.java b/extensions/identity-hub-verifier/src/test/java/org/eclipse/dataspaceconnector/identityhub/verifier/DidJwtCredentialsVerifierTest.java index 2c6eb1a9b..3a61947c0 100644 --- a/extensions/identity-hub-verifier/src/test/java/org/eclipse/dataspaceconnector/identityhub/verifier/DidJwtCredentialsVerifierTest.java +++ b/extensions/identity-hub-verifier/src/test/java/org/eclipse/dataspaceconnector/identityhub/verifier/DidJwtCredentialsVerifierTest.java @@ -42,54 +42,53 @@ public class DidJwtCredentialsVerifierTest { private static final Faker FAKER = new Faker(); private static final Monitor MONITOR = new ConsoleMonitor(); - - DidPublicKeyResolver didPublicKeyResolver = mock(DidPublicKeyResolver.class); - DidJwtCredentialsVerifier didJwtCredentialsVerifier = new DidJwtCredentialsVerifier(didPublicKeyResolver, MONITOR); - ECKey jwk = generateEcKey(); - ECKey anotherJwk = generateEcKey(); - String issuer = FAKER.internet().url(); - String subject = FAKER.internet().url(); - String otherSubject = FAKER.internet().url() + "other"; - SignedJWT jwt = buildSignedJwt(generateVerifiableCredential(), issuer, subject, jwk); + private static final ECKey JWK = generateEcKey(); + private static final ECKey ANOTHER_JWK = generateEcKey(); + private static final String ISSUER = FAKER.internet().url(); + private static final String SUBJECT = FAKER.internet().url(); + private static final String OTHER_SUBJECT = FAKER.internet().url() + "other"; + private static final SignedJWT JWT = buildSignedJwt(generateVerifiableCredential(), ISSUER, SUBJECT, JWK); + private DidPublicKeyResolver didPublicKeyResolver = mock(DidPublicKeyResolver.class); + private DidJwtCredentialsVerifier didJwtCredentialsVerifier = new DidJwtCredentialsVerifier(didPublicKeyResolver, MONITOR); @Test public void isSignedByIssuer_jwtSignedByIssuer() { // Arrange - when(didPublicKeyResolver.resolvePublicKey(issuer)).thenReturn(Result.success(toPublicKeyWrapper(jwk))); + when(didPublicKeyResolver.resolvePublicKey(ISSUER)).thenReturn(Result.success(toPublicKeyWrapper(JWK))); // Assert - assertThat(didJwtCredentialsVerifier.isSignedByIssuer(jwt)).isTrue(); + assertThat(didJwtCredentialsVerifier.isSignedByIssuer(JWT)).isTrue(); } @Test public void isSignedByIssuer_jwtSignedByWrongIssuer() { // Arrange - when(didPublicKeyResolver.resolvePublicKey(issuer)).thenReturn(Result.success(toPublicKeyWrapper(anotherJwk))); + when(didPublicKeyResolver.resolvePublicKey(ISSUER)).thenReturn(Result.success(toPublicKeyWrapper(ANOTHER_JWK))); // Assert - assertThat(didJwtCredentialsVerifier.isSignedByIssuer(jwt)).isFalse(); + assertThat(didJwtCredentialsVerifier.isSignedByIssuer(JWT)).isFalse(); } @Test public void isSignedByIssuer_PublicKeyCantBeResolved() { // Arrange - when(didPublicKeyResolver.resolvePublicKey(issuer)).thenReturn(Result.failure("Failed resolving public key")); + when(didPublicKeyResolver.resolvePublicKey(ISSUER)).thenReturn(Result.failure("Failed resolving public key")); // Assert - assertThat(didJwtCredentialsVerifier.isSignedByIssuer(jwt)).isFalse(); + assertThat(didJwtCredentialsVerifier.isSignedByIssuer(JWT)).isFalse(); } @Test public void isSignedByIssuer_issuerDidCantBeResolved() throws ParseException { // Arrange - when(didPublicKeyResolver.resolvePublicKey(jwt.getJWTClaimsSet().getIssuer())).thenReturn(Result.failure(FAKER.lorem().sentence())); + when(didPublicKeyResolver.resolvePublicKey(JWT.getJWTClaimsSet().getIssuer())).thenReturn(Result.failure(FAKER.lorem().sentence())); // Assert - assertThat(didJwtCredentialsVerifier.isSignedByIssuer(jwt)).isFalse(); + assertThat(didJwtCredentialsVerifier.isSignedByIssuer(JWT)).isFalse(); } @Test @@ -105,24 +104,24 @@ public void isSignedByIssuer_cantParsePayload() throws Exception { @Test void verifyClaims_success() { - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, subject)).isTrue(); + assertThat(didJwtCredentialsVerifier.verifyClaims(JWT, SUBJECT)).isTrue(); } @Test void verifyClaims_OnInvalidSubject() { - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, otherSubject)).isFalse(); + assertThat(didJwtCredentialsVerifier.verifyClaims(JWT, OTHER_SUBJECT)).isFalse(); } @Test void verifyClaims_OnEmptySubject() { - var jwt = buildSignedJwt(generateVerifiableCredential(), issuer, null, jwk); - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, otherSubject)).isFalse(); + var jwt = buildSignedJwt(generateVerifiableCredential(), ISSUER, null, JWK); + assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, OTHER_SUBJECT)).isFalse(); } @Test void verifyClaims_OnEmptyIssuer() { - var jwt = buildSignedJwt(generateVerifiableCredential(), null, subject, jwk); - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, subject)).isFalse(); + var jwt = buildSignedJwt(generateVerifiableCredential(), null, SUBJECT, JWK); + assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, SUBJECT)).isFalse(); } @Test @@ -133,58 +132,58 @@ public void verifyClaims_OnInvalidJwt() throws Exception { when(jwt.getJWTClaimsSet()).thenThrow(new ParseException(message, 0)); // Act - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, subject)).isFalse(); + assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, SUBJECT)).isFalse(); } @Test void verifyClaims_OnValidExp() { var claims = new JWTClaimsSet.Builder() - .issuer(issuer) - .subject(subject) + .issuer(ISSUER) + .subject(SUBJECT) .expirationTime(from(now().plus(1, DAYS))) .build(); - SignedJWT jwt = VerifiableCredentialTestUtil.buildSignedJwt(claims, jwk); + SignedJWT jwt = VerifiableCredentialTestUtil.buildSignedJwt(claims, JWK); - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, subject)).isTrue(); + assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, SUBJECT)).isTrue(); } @Test void verifyClaims_OnInvalidExp() { var claims = new JWTClaimsSet.Builder() - .issuer(issuer) - .subject(subject) + .issuer(ISSUER) + .subject(SUBJECT) .expirationTime(from(now().minus(1, DAYS))) .build(); - SignedJWT jwt = VerifiableCredentialTestUtil.buildSignedJwt(claims, jwk); + SignedJWT jwt = VerifiableCredentialTestUtil.buildSignedJwt(claims, JWK); - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, subject)).isFalse(); + assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, SUBJECT)).isFalse(); } @Test void verifyClaims_OnValidNotBefore() { var claims = new JWTClaimsSet.Builder() - .issuer(issuer) - .subject(subject) + .issuer(ISSUER) + .subject(SUBJECT) .notBeforeTime(from(now().minus(1, DAYS))) .build(); - SignedJWT jwt = VerifiableCredentialTestUtil.buildSignedJwt(claims, jwk); + SignedJWT jwt = VerifiableCredentialTestUtil.buildSignedJwt(claims, JWK); - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, subject)).isTrue(); + assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, SUBJECT)).isTrue(); } @Test void verifyClaims_OnInvalidNotBefore() { var claims = new JWTClaimsSet.Builder() - .issuer(issuer) - .subject(subject) + .issuer(ISSUER) + .subject(SUBJECT) .notBeforeTime(from(now().plus(1, DAYS))) .build(); - SignedJWT jwt = VerifiableCredentialTestUtil.buildSignedJwt(claims, jwk); + SignedJWT jwt = VerifiableCredentialTestUtil.buildSignedJwt(claims, JWK); - assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, subject)).isFalse(); + assertThat(didJwtCredentialsVerifier.verifyClaims(jwt, SUBJECT)).isFalse(); } } diff --git a/extensions/identity-hub-verifier/src/test/java/org/eclipse/dataspaceconnector/identityhub/verifier/IdentityHubCredentialsVerifierTest.java b/extensions/identity-hub-verifier/src/test/java/org/eclipse/dataspaceconnector/identityhub/verifier/IdentityHubCredentialsVerifierTest.java index 32ec333fc..d5f31ae2c 100644 --- a/extensions/identity-hub-verifier/src/test/java/org/eclipse/dataspaceconnector/identityhub/verifier/IdentityHubCredentialsVerifierTest.java +++ b/extensions/identity-hub-verifier/src/test/java/org/eclipse/dataspaceconnector/identityhub/verifier/IdentityHubCredentialsVerifierTest.java @@ -50,38 +50,37 @@ public class IdentityHubCredentialsVerifierTest { private static final Faker FAKER = new Faker(); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + private static final String HUB_BASE_URL = "https://" + FAKER.internet().url(); + private static final DidDocument DID_DOCUMENT = DidDocument.Builder.newInstance() + .service(List.of(new Service("IdentityHub", "IdentityHub", HUB_BASE_URL))).build(); + private static final String ISSUER = FAKER.internet().url(); + private static final String SUBJECT = FAKER.internet().url(); private Monitor monitorMock = mock(Monitor.class); private IdentityHubClient identityHubClientMock = mock(IdentityHubClient.class); private JwtCredentialsVerifier jwtCredentialsVerifierMock = mock(JwtCredentialsVerifier.class); - private VerifiableCredentialsJwtServiceImpl verifiableCredentialsJwtService = new VerifiableCredentialsJwtServiceImpl(OBJECT_MAPPER); private CredentialsVerifier credentialsVerifier = new IdentityHubCredentialsVerifier(identityHubClientMock, monitorMock, jwtCredentialsVerifierMock, verifiableCredentialsJwtService); - private String hubBaseUrl = "https://" + FAKER.internet().url(); - DidDocument didDocument = DidDocument.Builder.newInstance() - .service(List.of(new Service("IdentityHub", "IdentityHub", hubBaseUrl))).build(); - String issuer = FAKER.internet().url(); - String subject = FAKER.internet().url(); @Test public void getVerifiedClaims_getValidClaims() throws Exception { // Arrange var credential = generateVerifiableCredential(); - var jws = buildSignedJwt(credential, issuer, subject, generateEcKey()); + var jws = buildSignedJwt(credential, ISSUER, SUBJECT, generateEcKey()); setUpMocks(jws, true, true); // Act - var credentials = credentialsVerifier.getVerifiedCredentials(didDocument); + var credentials = credentialsVerifier.getVerifiedCredentials(DID_DOCUMENT); // Assert assertThat(credentials.succeeded()).isTrue(); assertThat(credentials.getContent()) .usingRecursiveComparison() - .isEqualTo(toMap(credential, issuer, subject)); + .isEqualTo(toMap(credential, ISSUER, SUBJECT)); } private void setUpMocks(SignedJWT jws, boolean isSigned, boolean claimsValid) { - when(identityHubClientMock.getVerifiableCredentials(hubBaseUrl)).thenReturn(StatusResult.success(List.of(jws))); + when(identityHubClientMock.getVerifiableCredentials(HUB_BASE_URL)).thenReturn(StatusResult.success(List.of(jws))); when(jwtCredentialsVerifierMock.isSignedByIssuer(jws)).thenReturn(isSigned); when(jwtCredentialsVerifierMock.verifyClaims(eq(jws), any())).thenReturn(claimsValid); } @@ -91,11 +90,11 @@ public void getVerifiedClaims_filtersSignedByWrongIssuer() throws Exception { // Arrange var credential = generateVerifiableCredential(); - var jws = buildSignedJwt(credential, issuer, subject, generateEcKey()); + var jws = buildSignedJwt(credential, ISSUER, SUBJECT, generateEcKey()); setUpMocks(jws, true, false); // Act - var credentials = credentialsVerifier.getVerifiedCredentials(didDocument); + var credentials = credentialsVerifier.getVerifiedCredentials(DID_DOCUMENT); // Assert assertThat(credentials.succeeded()).isTrue(); @@ -119,10 +118,10 @@ public void getVerifiedClaims_hubUrlNotResolved() { public void getVerifiedClaims_idHubCallFails() { // Arrange - when(identityHubClientMock.getVerifiableCredentials(hubBaseUrl)).thenReturn(StatusResult.failure(ResponseStatus.FATAL_ERROR)); + when(identityHubClientMock.getVerifiableCredentials(HUB_BASE_URL)).thenReturn(StatusResult.failure(ResponseStatus.FATAL_ERROR)); // Act - var credentials = credentialsVerifier.getVerifiedCredentials(didDocument); + var credentials = credentialsVerifier.getVerifiedCredentials(DID_DOCUMENT); // Assert assertThat(credentials.failed()).isTrue(); @@ -136,7 +135,7 @@ public void getVerifiedClaims_verifiableCredentialsWithWrongFormat() { setUpMocks(jws, true, true); // Act - var credentials = credentialsVerifier.getVerifiedCredentials(didDocument); + var credentials = credentialsVerifier.getVerifiedCredentials(DID_DOCUMENT); // Assert assertThat(credentials.succeeded()).isTrue(); @@ -153,13 +152,13 @@ public void getVerifiedClaims_verifiableCredentialsWithMissingId() { var jwtClaims = new JWTClaimsSet.Builder() .claim("vc", Map.of(FAKER.lorem().word(), FAKER.lorem().word())) .issuer(FAKER.lorem().word()) - .subject(subject) + .subject(SUBJECT) .build(); var jws = new SignedJWT(jwsHeader, jwtClaims); setUpMocks(jws, true, true); // Act - var credentials = credentialsVerifier.getVerifiedCredentials(didDocument); + var credentials = credentialsVerifier.getVerifiedCredentials(DID_DOCUMENT); // Assert assertThat(credentials.succeeded()).isTrue(); diff --git a/extensions/identity-hub/src/test/java/org/eclipse/dataspaceconnector/identityhub/processor/CollectionsWriteProcessorTest.java b/extensions/identity-hub/src/test/java/org/eclipse/dataspaceconnector/identityhub/processor/CollectionsWriteProcessorTest.java index abff54b69..6eff9210c 100644 --- a/extensions/identity-hub/src/test/java/org/eclipse/dataspaceconnector/identityhub/processor/CollectionsWriteProcessorTest.java +++ b/extensions/identity-hub/src/test/java/org/eclipse/dataspaceconnector/identityhub/processor/CollectionsWriteProcessorTest.java @@ -14,7 +14,6 @@ package org.eclipse.dataspaceconnector.identityhub.processor; -import com.fasterxml.jackson.databind.ObjectMapper; import com.github.javafaker.Faker; import com.nimbusds.jose.JWSAlgorithm; import com.nimbusds.jose.JWSHeader; @@ -41,7 +40,6 @@ public class CollectionsWriteProcessorTest { private static final Faker FAKER = new Faker(); - private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private IdentityHubStore identityHubStore; private CollectionsWriteProcessor writeProcessor; diff --git a/identity-hub-core/identity-hub-client/src/test/java/org/eclipse/dataspaceconnector/identityhub/client/IdentityHubClientImplIntegrationTest.java b/identity-hub-core/identity-hub-client/src/test/java/org/eclipse/dataspaceconnector/identityhub/client/IdentityHubClientImplIntegrationTest.java index 6f4e71fb6..6554d0f56 100644 --- a/identity-hub-core/identity-hub-client/src/test/java/org/eclipse/dataspaceconnector/identityhub/client/IdentityHubClientImplIntegrationTest.java +++ b/identity-hub-core/identity-hub-client/src/test/java/org/eclipse/dataspaceconnector/identityhub/client/IdentityHubClientImplIntegrationTest.java @@ -36,7 +36,7 @@ public class IdentityHubClientImplIntegrationTest { private static final String API_URL = "http://localhost:8181/api/identity-hub"; private static final Faker FAKER = new Faker(); - public static final VerifiableCredential VERIFIABLE_CREDENTIAL = VerifiableCredential.Builder.newInstance().id(FAKER.internet().uuid()).build(); + private static final VerifiableCredential VERIFIABLE_CREDENTIAL = VerifiableCredential.Builder.newInstance().id(FAKER.internet().uuid()).build(); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private IdentityHubClient client; diff --git a/spi/identity-hub-spi/src/test/java/org/eclipse/dataspaceconnector/identityhub/credentials/VerifiableCredentialsJwtServiceTest.java b/spi/identity-hub-spi/src/test/java/org/eclipse/dataspaceconnector/identityhub/credentials/VerifiableCredentialsJwtServiceTest.java index 714f83e1b..0212077ad 100644 --- a/spi/identity-hub-spi/src/test/java/org/eclipse/dataspaceconnector/identityhub/credentials/VerifiableCredentialsJwtServiceTest.java +++ b/spi/identity-hub-spi/src/test/java/org/eclipse/dataspaceconnector/identityhub/credentials/VerifiableCredentialsJwtServiceTest.java @@ -34,13 +34,13 @@ public class VerifiableCredentialsJwtServiceTest { - static final Faker FAKER = new Faker(); - static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - static final VerifiableCredential VERIFIABLE_CREDENTIAL = generateVerifiableCredential(); - static final JWSHeader JWS_HEADER = new JWSHeader.Builder(JWSAlgorithm.ES256).build(); - EcPrivateKeyWrapper privateKey; - EcPublicKeyWrapper publicKey; - VerifiableCredentialsJwtService service; + private static final Faker FAKER = new Faker(); + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + private static final VerifiableCredential VERIFIABLE_CREDENTIAL = generateVerifiableCredential(); + private static final JWSHeader JWS_HEADER = new JWSHeader.Builder(JWSAlgorithm.ES256).build(); + private EcPrivateKeyWrapper privateKey; + private EcPublicKeyWrapper publicKey; + private VerifiableCredentialsJwtService service; @BeforeEach public void setUp() { diff --git a/system-tests/tests/src/test/java/org/eclipse/dataspaceconnector/identityhub/systemtests/VerifiableCredentialsIntegrationTest.java b/system-tests/tests/src/test/java/org/eclipse/dataspaceconnector/identityhub/systemtests/VerifiableCredentialsIntegrationTest.java index d4f86af6e..c148b4bf7 100644 --- a/system-tests/tests/src/test/java/org/eclipse/dataspaceconnector/identityhub/systemtests/VerifiableCredentialsIntegrationTest.java +++ b/system-tests/tests/src/test/java/org/eclipse/dataspaceconnector/identityhub/systemtests/VerifiableCredentialsIntegrationTest.java @@ -40,22 +40,22 @@ @ExtendWith(EdcExtension.class) class VerifiableCredentialsIntegrationTest { - static final Faker FAKER = new Faker(); - static final String HUB_URL = "http://localhost:8182/api/identity-hub"; - static final String AUTHORITY_DID = "did:web:localhost%3A8080:authority"; - static final String PARTICIPANT_DID = "did:web:localhost%3A8080:participant"; - static final String AUTHORITY_PRIVATE_KEY_PATH = "resources/jwt/authority/private-key.pem"; - static final ObjectMapper MAPPER = new ObjectMapper(); - static final VerifiableCredential VC1 = VerifiableCredential.Builder.newInstance() + private static final Faker FAKER = new Faker(); + private static final String HUB_URL = "http://localhost:8182/api/identity-hub"; + private static final String AUTHORITY_DID = "did:web:localhost%3A8080:authority"; + private static final String PARTICIPANT_DID = "did:web:localhost%3A8080:participant"; + private static final String AUTHORITY_PRIVATE_KEY_PATH = "resources/jwt/authority/private-key.pem"; + private static final ObjectMapper MAPPER = new ObjectMapper(); + private static final VerifiableCredential VC1 = VerifiableCredential.Builder.newInstance() .id(FAKER.internet().uuid()) .credentialSubject(Map.of( FAKER.internet().uuid(), FAKER.lorem().word(), FAKER.internet().uuid(), FAKER.lorem().word())) .build(); - CommandLine cmd = IdentityHubCli.getCommandLine(); - StringWriter out = new StringWriter(); - StringWriter err = new StringWriter(); + private CommandLine cmd = IdentityHubCli.getCommandLine(); + private StringWriter out = new StringWriter(); + private StringWriter err = new StringWriter(); @BeforeEach void setUp(EdcExtension extension) {