Skip to content

Tests, maintenance, refactorings#2600

Merged
afranken merged 25 commits intomainfrom
junie-ctd-2
Sep 9, 2025
Merged

Tests, maintenance, refactorings#2600
afranken merged 25 commits intomainfrom
junie-ctd-2

Conversation

@afranken
Copy link
Member

@afranken afranken commented Sep 2, 2025

Description

More Junie evaluation and manual edits.

  • More tests
  • Refactor Kotlin to idiomatic syntax
  • Update checkstyle and fix violations
  • Run ktlint and fix violations
  • Update Maven wrapper

Related Issue

N/A

Tasks

  • I have signed the CLA.
  • I have written tests and verified that they fail without my change.

@afranken afranken self-assigned this Sep 2, 2025
@afranken afranken changed the title junie-ctd-2 Tests, maintenance, refactorings Sep 6, 2025
@afranken afranken force-pushed the junie-ctd-2 branch 2 times, most recently from 7e47d78 to 0c617f5 Compare September 6, 2025 14:34
@afranken afranken force-pushed the junie-ctd-2 branch 3 times, most recently from 6ccd67a to 53b9529 Compare September 9, 2025 06:30
@afranken afranken requested a review from Copilot September 9, 2025 07:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive maintenance improvements including adding more tests, refactoring Kotlin code to idiomatic syntax, and updating build tooling with checkstyle/ktlint formatting fixes.

  • Added new tests and expanded test coverage across various components
  • Refactored Kotlin code to use more idiomatic syntax, improving readability and maintainability
  • Updated Maven wrapper, added ktlint for Kotlin formatting, and fixed checkstyle violations

Reviewed Changes

Copilot reviewed 103 out of 126 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
testsupport/testcontainers/src/main/java/com/adobe/testing/s3mock/testcontainers/S3MockContainer.java Added Javadoc comment for S3MockContainer class
testsupport/testcontainers/pom.xml Added test scope to dependency
testsupport/pom.xml Added Maven Javadoc skip property and ktlint plugin configuration
testsupport/junit4/src/main/java/com/adobe/testing/s3mock/junit4/S3MockRule.java Reorganized method order for better code structure
testsupport/common/src/main/java/com/adobe/testing/s3mock/testsupport/common/S3MockStarter.java Improved Javadoc formatting with proper spacing
server/src/test/kotlin/ Extensive Kotlin refactoring to idiomatic syntax across test files
server/src/main/resources/application.properties Enabled lazy initialization for Spring
server/src/main/java/ Various improvements including documentation, null safety, and bug fixes
mvnw, mvnw.cmd Updated Maven wrapper to version 3.3.3
integration-tests/src/test/kotlin/ Converted integration tests to idiomatic Kotlin syntax
pom.xml Added ktlint plugin, updated checkstyle configuration, and improved Maven settings

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

return File(Objects.requireNonNull(classLoader.getResource(fileName)).file)
val testClass = requireNotNull(testInfo.testClass.orElse(null)) { "Test class is not present in TestInfo" }
val resource = requireNotNull(testClass.classLoader.getResource(fileName)) { "Resource not found on classpath: $fileName" }
return File(resource.toURI())
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The toURI() method can throw URISyntaxException which is not handled. Consider wrapping this in a try-catch block or documenting that this method can throw an exception.

Copilot uses AI. Check for mistakes.
Comment on lines +284 to +288
var rootPath = rootFolder.toPath().toAbsolutePath().normalize();
var candidate = rootPath.resolve(bucketName).normalize();
if (!candidate.startsWith(rootPath)) {
throw new IllegalArgumentException("Invalid bucket name (path traversal detected).");
}
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good security improvement to prevent path traversal attacks. However, consider also validating that the bucket name doesn't contain null bytes or other potentially dangerous characters before path resolution.

Copilot uses AI. Check for mistakes.
fun `PUT part creates the correct set of folders and files`() {
val fileName = "PartFile"
val partNumber = "1"
val partNumber = 1
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from String to Int for partNumber is good, but ensure all test assertions and mock verifications are updated consistently throughout the file to expect Int instead of String.

Copilot uses AI. Check for mistakes.
@afranken afranken merged commit b10710a into main Sep 9, 2025
6 checks passed
@afranken afranken deleted the junie-ctd-2 branch September 9, 2025 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants