Skip to content

Commit

Permalink
fix: javadoc, imports and throws
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-vavdiya committed May 29, 2024
1 parent 171434e commit af87ecb
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public interface WalletKeyRepository extends BaseRepository<WalletKey, Long> {
/**
* Gets by wallet id and algorithm.
*
* @param id the id param algorithm the algorithm
* @param id the wallet id
* @param algorithm the algorithm
* @return the by wallet id
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@
import liquibase.database.jvm.JdbcConnection;
import liquibase.resource.ClassLoaderResourceAccessor;
import lombok.SneakyThrows;
import org.h2.command.query.Select;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.sql.Timestamp;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

class SetSigningServiceTypeToExistingWalletsTest {
public static final int EXPECTED_WALLET_COUNT = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.eclipse.tractusx.ssi.lib.crypt.x25519.X25519PrivateKey;
import org.eclipse.tractusx.ssi.lib.did.resolver.DidResolver;
import org.eclipse.tractusx.ssi.lib.exception.did.DidParseException;
import org.eclipse.tractusx.ssi.lib.exception.did.DidResolverException;
import org.eclipse.tractusx.ssi.lib.exception.key.InvalidPrivateKeyFormatException;
import org.eclipse.tractusx.ssi.lib.exception.key.KeyTransformationException;
import org.eclipse.tractusx.ssi.lib.jwt.SignedJwtFactory;
Expand All @@ -78,10 +77,8 @@
import org.mockito.stubbing.Answer;
import org.springframework.security.oauth2.jwt.JwtException;

import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.text.ParseException;
import java.time.Duration;
import java.time.Instant;
import java.util.Collections;
Expand Down Expand Up @@ -170,7 +167,7 @@ class issueMembershipCredentialTest {

@Test
void shouldIssueCredentialAsJwt()
throws IOException, InvalidPrivateKeyFormatException, KeyTransformationException {
throws InvalidPrivateKeyFormatException, KeyTransformationException {
Map<String, Object> wallets = mockBaseAndHolderWallet();
Wallet baseWallet = (Wallet) wallets.get("base");
String baseWalletBpn = baseWallet.getBpn();
Expand Down Expand Up @@ -225,7 +222,7 @@ class issueFrameWorkCredentialTest {

@Test
void shouldIssueCredentialAsJwt()
throws IOException, InvalidPrivateKeyFormatException, ParseException, JwtException, KeyTransformationException {
throws InvalidPrivateKeyFormatException, JwtException, KeyTransformationException {
Map<String, Object> wallets = mockBaseAndHolderWallet();
Wallet baseWallet = (Wallet) wallets.get("base");
String baseWalletBpn = baseWallet.getBpn();
Expand Down Expand Up @@ -285,7 +282,7 @@ void shouldIssueCredentialAsJwt()
class issueDismantlerCredentialTest {

@Test
void shouldIssueCredentialAsJwt() throws IOException, InvalidPrivateKeyFormatException, ParseException,
void shouldIssueCredentialAsJwt() throws InvalidPrivateKeyFormatException,
JwtException, KeyTransformationException {
Map<String, Object> wallets = mockBaseAndHolderWallet();
Wallet baseWallet = (Wallet) wallets.get("base");
Expand Down Expand Up @@ -337,7 +334,7 @@ void shouldIssueCredentialAsJwt() throws IOException, InvalidPrivateKeyFormatExc
class issueCredentialUsingBaseWallet {

@Test
void shouldIssueCredentialAsJwt() throws IOException, ParseException, InvalidPrivateKeyFormatException,
void shouldIssueCredentialAsJwt() throws InvalidPrivateKeyFormatException,
KeyTransformationException, JwtException {
Map<String, Object> wallets = mockBaseAndHolderWallet();
Wallet baseWallet = (Wallet) wallets.get("base");
Expand All @@ -363,7 +360,7 @@ void shouldIssueCredentialAsJwt() throws IOException, ParseException, InvalidPri
when(holdersCredentialRepository.save(any(HoldersCredential.class)))
.thenAnswer(new Answer<HoldersCredential>() {
@Override
public HoldersCredential answer(InvocationOnMock invocation) throws Throwable {
public HoldersCredential answer(InvocationOnMock invocation) {
HoldersCredential argument = invocation.getArgument(0, HoldersCredential.class);
argument.setId(42L);
return argument;
Expand Down Expand Up @@ -506,7 +503,7 @@ private void mockCommon(
when(holdersCredentialRepository.save(any(HoldersCredential.class)))
.thenAnswer(new Answer<HoldersCredential>() {
@Override
public HoldersCredential answer(InvocationOnMock invocation) throws Throwable {
public HoldersCredential answer(InvocationOnMock invocation) {
HoldersCredential argument = invocation.getArgument(0, HoldersCredential.class);
argument.setId(42L);
return argument;
Expand All @@ -527,7 +524,7 @@ private void validateCredentialResponse(CredentialsResponse credentialsResponse,

SignedJwtVerifier jwtVerifier = new SignedJwtVerifier(new DidResolver() {
@Override
public DidDocument resolve(Did did) throws DidResolverException {
public DidDocument resolve(Did did) {
return didDocument;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public static void makeCreateWorkForHolder(HoldersCredentialRepository holdersCr
when(holdersCredentialRepository.save(any(HoldersCredential.class)))
.thenAnswer(new Answer<HoldersCredential>() {
@Override
public HoldersCredential answer(InvocationOnMock invocation) throws Throwable {
public HoldersCredential answer(InvocationOnMock invocation) {
HoldersCredential argument = invocation.getArgument(0, HoldersCredential.class);
argument.setId(42L);
return argument;
Expand All @@ -245,7 +245,7 @@ public static void makeCreateWorkForIssuer(IssuersCredentialRepository issuersCr
when(issuersCredentialRepository.save(any(IssuersCredential.class)))
.thenAnswer(new Answer<IssuersCredential>() {
@Override
public IssuersCredential answer(InvocationOnMock invocation) throws Throwable {
public IssuersCredential answer(InvocationOnMock invocation) {
IssuersCredential argument = invocation.getArgument(0, IssuersCredential.class);
argument.setId(42L);
return argument;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void issueFrameworkCredentialTest403() {
}

@Test
void issueFrameworkCredentialWithInvalidBpnAccessTest403() throws JsonProcessingException, JSONException {
void issueFrameworkCredentialWithInvalidBpnAccessTest403() throws JSONException {
String bpn = TestUtils.getRandomBpmNumber();
String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString();
TestUtils.createWallet(bpn, did, walletRepository);
Expand All @@ -118,7 +118,7 @@ void issueFrameworkCredentialWithInvalidBpnAccessTest403() throws JsonProcessing
}

@Test
void issueFrameWorkVCToBaseWalletTest201() throws JSONException, JsonProcessingException {
void issueFrameWorkVCToBaseWalletTest201() throws JSONException {
String bpn = miwSettings.authorityWalletBpn();
String type = "PcfCredential";
//create wallet
Expand Down Expand Up @@ -176,7 +176,7 @@ static Stream<IssueFrameworkCredentialRequest> getTypes() {

@Test
@DisplayName("Issue framework with invalid type")
void issueFrameworkCredentialTest400() throws JsonProcessingException, JSONException {
void issueFrameworkCredentialTest400() throws JSONException {
String bpn = TestUtils.getRandomBpmNumber();
String did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), bpn).toString();
Wallet wallet = TestUtils.createWallet(bpn, did, walletRepository);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti

@Test
@DisplayName("Get Credentials as JWT")
void getCredentialsAsJWT200() throws com.fasterxml.jackson.core.JsonProcessingException, JSONException {
void getCredentialsAsJWT200() throws JSONException {

String baseDID = miwSettings.authorityWalletDid();
String bpn = TestUtils.getRandomBpmNumber();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti

@Test
@DisplayName("Get Credentials as JWT")
void getCredentialsAsJWT200() throws com.fasterxml.jackson.core.JsonProcessingException, JSONException {
void getCredentialsAsJWT200() throws JSONException {
String baseBPN = miwSettings.authorityWalletBpn();
String holderBpn = TestUtils.getRandomBpmNumber();
String holderDID = "did:web:localhost:" + holderBpn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

package org.eclipse.tractusx.managedidentitywallets.vc;

import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.SneakyThrows;
import org.eclipse.tractusx.managedidentitywallets.ManagedIdentityWalletsApplication;
import org.eclipse.tractusx.managedidentitywallets.config.MIWSettings;
Expand Down Expand Up @@ -109,7 +108,7 @@ public void test() {
}

@SneakyThrows
private VerifiableCredential issueVC(String issuerDid, Wallet signerWallet) throws JsonProcessingException {
private VerifiableCredential issueVC(String issuerDid, Wallet signerWallet) {
List<URI> contexts = new ArrayList();
contexts.add(URI.create("https://www.w3.org/2018/credentials/v1"));
// if the credential does not contain the JWS proof-context add it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void createWalletTestWithUserToken403() {

@Test
@DisplayName("Create wallet with invalid BPN, it should return 400 ")
void createWalletWithInvalidBPNTest400() throws JsonProcessingException, JSONException {
void createWalletWithInvalidBPNTest400() throws JSONException {
String bpn = "invalid bpn";
String name = "Sample Wallet";
String baseBpn = miwSettings.authorityWalletBpn();
Expand Down

0 comments on commit af87ecb

Please sign in to comment.