@Test void testValidateShouldReturnValidationError() { EnvironmentDto environmentDto = createEnvironmentDto(PUBLIC_KEY, null); String expected = "1. Failed to parse public key. Detailed message: Corrupt or unknown public key file format"; ValidationResult actual = underTest.validate(environmentDto); Assertions.assertEquals(expected, actual.getFormattedErrors()); }
public ValidationResult validate(EnvironmentDto environmentDto) { ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder(); AuthenticationDto authentication = environmentDto.getAuthentication(); if (!StringUtils.hasText(authentication.getPublicKeyId())) { validate(authentication.getPublicKey(), resultBuilder); } return resultBuilder.build(); }
EnvironmentAuthenticationValidator { public ValidationResult validate(EnvironmentDto environmentDto) { ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder(); AuthenticationDto authentication = environmentDto.getAuthentication(); if (!StringUtils.hasText(authentication.getPublicKeyId())) { validate(authentication.getPublicKey(), resultBuilder); } return resultBuilder.build(); } }
EnvironmentAuthenticationValidator { public ValidationResult validate(EnvironmentDto environmentDto) { ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder(); AuthenticationDto authentication = environmentDto.getAuthentication(); if (!StringUtils.hasText(authentication.getPublicKeyId())) { validate(authentication.getPublicKey(), resultBuilder); } return resultBuilder.build(); }  }
EnvironmentAuthenticationValidator { public ValidationResult validate(EnvironmentDto environmentDto) { ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder(); AuthenticationDto authentication = environmentDto.getAuthentication(); if (!StringUtils.hasText(authentication.getPublicKeyId())) { validate(authentication.getPublicKey(), resultBuilder); } return resultBuilder.build(); }  ValidationResult validate(EnvironmentDto environmentDto); }
EnvironmentAuthenticationValidator { public ValidationResult validate(EnvironmentDto environmentDto) { ValidationResult.ValidationResultBuilder resultBuilder = ValidationResult.builder(); AuthenticationDto authentication = environmentDto.getAuthentication(); if (!StringUtils.hasText(authentication.getPublicKeyId())) { validate(authentication.getPublicKey(), resultBuilder); } return resultBuilder.build(); }  ValidationResult validate(EnvironmentDto environmentDto);  }