Skip to content

Add ability to check that the file is downloaded and appears in the e…#6184

Open
TatianaTochko wants to merge 1 commit intovividus-framework:masterfrom
TatianaTochko:feature/6015
Open

Add ability to check that the file is downloaded and appears in the e…#6184
TatianaTochko wants to merge 1 commit intovividus-framework:masterfrom
TatianaTochko:feature/6015

Conversation

@TatianaTochko
Copy link
Copy Markdown
Contributor

@TatianaTochko TatianaTochko commented Oct 7, 2025

…xpected folder

Summary by CodeRabbit

  • New Features

    • Added a reusable file-existence validation step to create a temp file and assert a regular file exists at a specified path.
  • Documentation

    • Expanded ZIP archive guidance: "Save archive entries" now maps entries into variables with parameter table and outputFormat (TEXT, BASE64); note about REST API plugin for HTTP examples.
    • Clarified that some execution steps expect the full variable name (not a reference).
  • Tests

    • Added/expanded tests for valid, missing, directory, invalid, empty and null path cases and soft‑assert behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@TatianaTochko TatianaTochko requested a review from a team as a code owner October 7, 2025 18:49
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 7, 2025

📝 Walkthrough

Walkthrough

Adds a new step to assert a file exists at a resolved path, converts field injection to constructor injection in FileSteps, introduces a FILE constant, updates documentation for file-existence and ZIP archive entries, and adds unit and integration tests covering valid, missing, invalid, and malformed path scenarios.

Changes

Cohort / File(s) Summary
Documentation
docs/modules/commons/pages/vividus-steps.adoc
Added "File existence validation" block with Given/When/Then example and note about full file path; revised "Save ZIP archive entries" to document saving archive entries into variables with parameter table (path, variable, scopes, outputFormat), described TEXT/BASE64 outputs, and noted vividus-rest-api requirement for HTTP examples.
File steps implementation
vividus/src/main/java/org/vividus/steps/FileSteps.java
Replaced field injection with constructor injection for VariableContext and ISoftAssert; added FILE constant; added @Then method assertPathExists(String filePath) that validates input (null/empty/blank), handles InvalidPathException, resolves the Path, checks Files.isRegularFile, and reports results via ISoftAssert (pass/fail messages referencing the resolved path).
Unit tests
vividus/src/test/java/org/vividus/steps/FileStepsTests.java
Added/updated tests and constants for file name/content; added tests for null/empty/blank path validation, invalid path handling, existing path (pass), missing path and directory-as-path (fail); wired ISoftAssert mock and verified interactions (including verifyNoMoreInteractions).
Integration story
vividus-tests/src/main/resources/story/integration/File validation steps.story
New story: sets epic/feature, initializes a temporary file path variable, creates a file with content at that path, and asserts the file exists using the new step.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Story
    participant FileSteps
    participant FS as Filesystem
    participant SoftAssert as ISoftAssert

    Note over Story,FileSteps: Scenario may create a file then assert its existence
    User->>Story: run "create temp file" step
    Story->>FileSteps: createFile(tempPath, content)
    FileSteps->>FS: write file at tempPath
    FS-->>FileSteps: write result

    User->>Story: run "file exists at path" step
    Story->>FileSteps: assertPathExists(tempPath)
    alt input is null/blank
        FileSteps->>SoftAssert: recordFailedAssertion("path must not be blank")
    else input is invalid (InvalidPathException)
        FileSteps->>SoftAssert: recordFailedAssertion("Invalid path: ...")
    else valid path
        FileSteps->>FS: isRegularFile(tempPath)?
        alt file exists and is regular
            FileSteps->>SoftAssert: recordPassedAssertion("File '" + tempPath + "' exists")
        else missing or not regular
            FileSteps->>SoftAssert: recordFailedAssertion("File '" + tempPath + "' does not exist")
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus areas:
    • Messages and behavior in assertPathExists (null/blank validation, InvalidPathException messaging, and exact failure strings).
    • Constructor injection change and ensuring test wiring of ISoftAssert/VariableContext.
    • Unit tests' expectations and verifyNoMoreInteractions usage.
    • Documentation correctness for ZIP entries parameterization and outputFormat details.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title is incomplete and truncated ('Add ability to check that the file is downloaded and appears in the e…'), making it impossible to assess whether it accurately describes the main changes. Complete the title to its full length so it can be properly evaluated. The title should clearly describe the primary change without truncation.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bda5950 and 034d415.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/File validation steps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (3 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (6)
vividus-tests/src/main/resources/story/integration/File validation steps.story (1)

1-8: Happy-path integration scenario is consistent with the new step.

The story correctly uses a full file path variable, creates the file at that exact path, and then asserts existence via the new step, matching the documented behaviour.

docs/modules/commons/pages/vividus-steps.adoc (1)

475-492: File-existence documentation matches implementation and usage.

The description, parameter note, and Gherkin example accurately describe the step (file exists at path) and consistently treat $filePath as the full file path, in line with FileSteps.assertPathExists and the integration story.

vividus/src/main/java/org/vividus/steps/FileSteps.java (2)

39-48: Constructor injection and shared message prefix improve design.

Using final fields with a constructor and centralizing the "File '" prefix in a constant makes the class easier to test and keeps assertion messages consistent.


89-117: assertPathExists handles invalid inputs and file checks robustly.

The method cleanly separates concerns: a precondition for null/blank paths, controlled handling of malformed paths, and clear soft-assert outcomes for existing vs. non-existing (or non-file) paths. Behaviour aligns with the new tests and documentation.

vividus/src/test/java/org/vividus/steps/FileStepsTests.java (2)

52-82: Test refactor with shared constants and content checks is clean.

Reusing FILE_CONTENT/FILE_NAME and asserting the actual file contents via FileUtils keeps the tests readable while validating the real I/O behaviour of the creation steps.


92-140: Strong coverage of assertPathExists branches.

The parameterized invalid-path test plus the separate tests for existing file, non-existent file, directory path, and malformed path collectively exercise all key paths, including exception throwing and soft-assert messages, with verifyNoMoreInteractions guarding against unintended calls.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc36bb2 and fe0a54e.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (3 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (6)
vividus/src/main/java/org/vividus/steps/FileSteps.java (2)

24-24: LGTM!

The new imports for Paths and ISoftAssert are necessary for the file existence validation functionality.

Also applies to: 32-32


41-41: LGTM!

The ISoftAssert injection follows the existing pattern and is properly configured for dependency injection.

docs/modules/commons/pages/vividus-steps.adoc (1)

448-471: LGTM!

The documentation for the File Existence Validation step is clear and comprehensive, with good examples covering both static and dynamic filename scenarios. The examples align well with the integration test scenarios.

vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1)

1-12: LGTM!

The integration test scenarios provide good coverage of the file existence validation step, including both static and dynamic filename patterns. The use of the generateDate expression in the dynamic scenario demonstrates practical usage with runtime-generated values.

vividus/src/test/java/org/vividus/steps/FileStepsTests.java (2)

47-48: LGTM!

The introduction of FILE_CONTENT and FILE_NAME constants improves test maintainability and reduces duplication.


86-118: Good test coverage with proper isolation.

The new test methods provide good coverage of the file existence validation functionality, including edge cases like nested directories. The use of @TempDir ensures proper test isolation. However, as noted in a separate comment, these tests should also verify the softAssert interactions.

Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.78%. Comparing base (0ca713d) to head (034d415).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #6184   +/-   ##
=========================================
  Coverage     97.78%   97.78%           
  Complexity     7369     7369           
=========================================
  Files          1010     1010           
  Lines         21336    21350   +14     
  Branches       1398     1399    +1     
=========================================
+ Hits          20863    20877   +14     
  Misses          357      357           
  Partials        116      116           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe0a54e and 4902c22.

📒 Files selected for processing (2)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (3 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: system-kafka-tests
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (windows-latest)

Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java
Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java Outdated
@valfirst
Copy link
Copy Markdown
Collaborator

valfirst commented Oct 9, 2025

@TatianaTochko please fix the failing builds

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c5dea8 and eef6f85.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (4 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (5)
vividus/src/main/java/org/vividus/steps/FileSteps.java (1)

82-100: LGTM! Well-implemented file existence validation.

The implementation correctly addresses all previous review feedback:

  • Method is now void (appropriate for a Then-step)
  • Null checks prevent NPEs with clear error messages
  • Soft assertion provides proper test feedback
  • Formatting is clean and readable

The path construction using Paths.get(filePath, fileName) correctly combines the directory path with the filename.

vividus/src/test/java/org/vividus/steps/FileStepsTests.java (2)

47-50: Good use of constants for test data.

The introduction of well-named constants (FILE_CONTENT, FILE_EXIST, FILE_NAME, FILE_NAME_AND_FILE_PATH_MUST_NOT_BE_NULL) improves test maintainability and reduces duplication.


104-115: Rename test to reflect void method behavior.

The test name shouldReturnTrueWhenFileExists suggests the method returns a value, but doesFileExist is now void. The test correctly verifies the soft assertion behavior.

Consider renaming to reflect the assertion behavior:

-    void shouldReturnTrueWhenFileExists(@TempDir Path tempDir) throws IOException
+    void shouldAssertTrueWhenFileExists(@TempDir Path tempDir) throws IOException

Likely an incorrect or invalid review comment.

vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1)

1-12: Excellent integration test coverage.

The story provides good coverage of the new file existence validation step:

  1. Static filename scenario (lines 5-7): Tests straightforward file validation
  2. Dynamic filename scenario (lines 9-12): Tests with variable interpolation using generateDate expression

Both scenarios follow the logical pattern of creating a file first, then validating its existence. The meta tags appropriately categorize the story.

docs/modules/commons/pages/vividus-steps.adoc (1)

448-471: Well-documented step with clear examples.

The documentation provides:

  • Clear step syntax matching the implementation
  • Descriptive parameter explanations
  • Two practical examples: static filename and dynamic filename with variable interpolation
  • Consistent formatting with the rest of the document

The examples align with the integration test scenarios in FileValidationSteps.story, demonstrating good coordination between code, tests, and documentation.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eef6f85 and 8f47392.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (4 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: system-kafka-tests
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (windows-latest)
🔇 Additional comments (3)
vividus/src/main/java/org/vividus/steps/FileSteps.java (1)

82-100: LGTM! Implementation addresses previous review feedback.

The implementation correctly:

  • Uses void return type for a Then-step
  • Includes defensive null checks with clear error messages
  • Constructs the full path using standard Java NIO
  • Performs soft assertions with descriptive messages
vividus/src/test/java/org/vividus/steps/FileStepsTests.java (2)

47-50: Well-structured test constants improve maintainability.

The introduction of test constants (FILE_CONTENT, FILE_EXIST, FILE_NAME, FILE_NAME_AND_FILE_PATH_MUST_NOT_BE_NULL) eliminates magic strings and makes the tests more maintainable.


88-127: Comprehensive test coverage for the new validation step.

The test suite properly covers:

  • Null parameter validation for both fileName and filePath
  • Successful file existence verification with ArgumentCaptor
  • Failed verification when file doesn't exist
  • Proper verification of soft assertion interactions

The use of ArgumentCaptor to verify both the message format and boolean values is a best practice for testing assertion behavior.

Comment thread docs/modules/commons/pages/vividus-steps.adoc Outdated
Comment thread docs/modules/commons/pages/vividus-steps.adoc Outdated
Comment thread vividus-tests/src/main/resources/story/integration/FileValidationSteps.story Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
vividus/src/test/java/org/vividus/steps/FileStepsTests.java (2)

117-127: Consider renaming test to reflect void method behavior.

Similar to the previous test, shouldReturnFalseWhenFileDoesNotExist implies a return value. Consider a name that better reflects the assertion behavior.

Suggested rename:

-    void shouldReturnFalseWhenFileDoesNotExist(@TempDir Path tempDir)
+    void shouldAssertFalseWhenFileDoesNotExist(@TempDir Path tempDir)

or

-    void shouldReturnFalseWhenFileDoesNotExist(@TempDir Path tempDir)
+    void shouldVerifyFileMissingWhenFileDoesNotExist(@TempDir Path tempDir)

104-115: Consider renaming test to reflect void method behavior.

The test name shouldReturnTrueWhenFileExists implies a return value, but the method is void and uses soft assertions. Consider a name that better reflects the assertion behavior.

Suggested rename:

-    void shouldReturnTrueWhenFileExists(@TempDir Path tempDir) throws IOException
+    void shouldAssertTrueWhenFileExists(@TempDir Path tempDir) throws IOException

or

-    void shouldReturnTrueWhenFileExists(@TempDir Path tempDir) throws IOException
+    void shouldVerifyFileExistsWhenFileIsPresent(@TempDir Path tempDir) throws IOException
vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1)

5-8: Missing variable initialization will cause test failure.

Line 7 references ${temp-file-content} but this variable is never initialized in the scenario. This will either:

  1. Cause the step to fail if the variable is required
  2. Create a file containing the literal text ${temp-file-content} instead of actual content

Apply this diff to initialize the variable:

 Scenario: Verify file existence validation
 Given I initialize scenario variable `test-dir` with value `${java.io.tmpdir}`
+Given I initialize scenario variable `temp-file-content` with value `Sample test content`
 When I create file with content `${temp-file-content}` at path `${test-dir}/test-file.txt`
 Then file with name `test-file.txt` exists by path `${test-dir}`
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f47392 and 4bdf9e0.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (4 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: system-kafka-tests
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
🔇 Additional comments (9)
vividus/src/main/java/org/vividus/steps/FileSteps.java (3)

2-2: LGTM: Copyright year updated.

The copyright year has been correctly updated to 2025.


24-24: LGTM: Required imports and dependency injection.

The necessary imports (Paths, Then, ISoftAssert) and the injected ISoftAssert field have been correctly added to support the new file existence validation step.

Also applies to: 29-29, 32-32, 41-41


82-100: LGTM: File existence validation step implemented correctly.

The implementation addresses all previous review feedback:

  • Method is void (no longer returns boolean)
  • Javadoc is correct (no @return tag)
  • Null checks are in place with appropriate error messages
  • Path construction and file existence check are correct
  • Soft assertion provides clear error message
docs/modules/commons/pages/vividus-steps.adoc (1)

448-459: LGTM: Clear documentation for the new step.

The documentation clearly describes the new file existence validation step, including parameter descriptions and usage.

vividus/src/test/java/org/vividus/steps/FileStepsTests.java (5)

2-2: LGTM: Copyright year updated.

The copyright year has been correctly updated to 2025.


23-23: LGTM: Test infrastructure properly configured.

The necessary imports (verifyNoMoreInteractions, ArgumentCaptor) and the ISoftAssert mock have been correctly added to support testing the new file existence validation behavior.

Also applies to: 36-36, 41-41, 55-56


47-50: LGTM: Test constants improve maintainability.

The introduction of constants for test data (FILE_CONTENT, FILE_EXIST, FILE_NAME, FILE_NAME_AND_FILE_PATH_MUST_NOT_BE_NULL) enhances readability and reduces duplication across tests.


61-78: LGTM: Existing tests updated to use constants.

The existing tests have been correctly updated to use the new constants instead of inline literals, improving consistency and maintainability.

Also applies to: 80-86


88-94: LGTM: Null parameter validation tests are thorough.

Both null check tests correctly verify that:

  1. softAssert.recordFailedAssertion is called with the expected message
  2. No other interactions occur with the soft assert mock

This ensures the early-return behavior works as expected.

Also applies to: 96-102

Comment thread docs/modules/commons/pages/vividus-steps.adoc Outdated
@TatianaTochko TatianaTochko force-pushed the feature/6015 branch 2 times, most recently from 7c5d7fa to bc57aac Compare October 27, 2025 08:24
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
vividus/src/test/java/org/vividus/steps/FileStepsTests.java (1)

104-127: Consider renaming test methods to reflect void behavior.

The test method names shouldReturnTrueWhenFileExists and shouldReturnFalseWhenFileDoesNotExist are misleading since doesFileExist is a void method that performs assertions rather than returning values. The "shouldReturn" prefix suggests a return value.

Consider renaming to better reflect the assertion behavior:

-    void shouldReturnTrueWhenFileExists(@TempDir Path tempDir) throws IOException
+    void shouldAssertTrueWhenFileExists(@TempDir Path tempDir) throws IOException
-    void shouldReturnFalseWhenFileDoesNotExist(@TempDir Path tempDir)
+    void shouldAssertFalseWhenFileDoesNotExist(@TempDir Path tempDir)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7c5d7fa and bc57aac.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (4 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (6)
vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1)

5-9: LGTM! The integration scenario is correctly structured.

The scenario properly initializes the test directory, creates a file, and validates its existence. The past path construction issue has been successfully resolved by using the system temp directory variable and passing it correctly to the validation step.

vividus/src/main/java/org/vividus/steps/FileSteps.java (1)

2-2: LGTM! Copyright year updated appropriately.

docs/modules/commons/pages/vividus-steps.adoc (1)

448-467: LGTM! Documentation is clear and complete.

The File Existence Validation documentation accurately describes the new step with a complete, working example that properly initializes all required variables and demonstrates the correct usage pattern.

vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3)

2-2: LGTM! Copyright year updated appropriately.


47-50: LGTM! Well-defined test constants improve maintainability.

The constants are appropriately scoped and clearly named, making the tests more readable and maintainable.


88-102: LGTM! Comprehensive null parameter validation.

Both null check tests properly verify that the soft assertion records the failure and that no additional interactions occur. Good defensive test coverage.

@TatianaTochko TatianaTochko force-pushed the feature/6015 branch 2 times, most recently from 7270b8d to 2ca0ebf Compare October 28, 2025 07:39
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc57aac and 2ca0ebf.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (4 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (9)
vividus/src/test/java/org/vividus/steps/FileStepsTests.java (5)

2-2: LGTM!

The copyright update, new imports, constants, and mock setup are appropriate for the new test functionality. The constants improve test maintainability and readability.

Also applies to: 23-23, 36-36, 41-41, 47-57


62-87: Good refactoring to use constants.

The existing tests have been appropriately updated to use the new constants, improving maintainability without changing test behavior.


89-103: Excellent null parameter validation tests.

The tests properly verify that null parameters are caught early with descriptive error messages, and correctly use verifyNoMoreInteractions to ensure no additional assertions are performed.


105-116: Well-structured file existence test.

The test correctly creates an actual file, verifies the soft assertion is called with the expected message and boolean value using ArgumentCaptor. Good use of @tempdir for automatic cleanup.


118-128: Correct negative test case.

The test properly validates the scenario when a file does not exist, verifying that the soft assertion receives the expected message and false boolean value.

vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1)

1-9: LGTM!

The integration story correctly demonstrates the file existence validation feature. The path construction is correct: the file is created at ${test-dir}/test-file.txt and validated by checking for filename test-file.txt at directory ${test-dir}.

vividus/src/main/java/org/vividus/steps/FileSteps.java (2)

2-2: LGTM!

The copyright update, new imports, and ISoftAssert injection are appropriate for the new file existence validation functionality.

Also applies to: 24-24, 29-29, 32-32, 41-41


82-105: Well-implemented file existence validation step.

The method properly:

  • Validates null inputs with specific error messages
  • Constructs the full path using Paths.get(filePath, fileName)
  • Uses soft assertions with descriptive messaging
  • Follows the existing codebase patterns
docs/modules/commons/pages/vividus-steps.adoc (1)

448-459: Good documentation structure and clarity.

The documentation clearly explains the new file existence validation step with appropriate parameter descriptions.

Comment thread docs/modules/commons/pages/vividus-steps.adoc
@TatianaTochko TatianaTochko force-pushed the feature/6015 branch 3 times, most recently from 2045e82 to ebcb6d8 Compare October 28, 2025 14:54
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2045e82 and ebcb6d8.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (4 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (5)
vividus/src/main/java/org/vividus/steps/FileSteps.java (1)

24-33: LGTM: proper dependencies and injection.

Adding Paths and injecting ISoftAssert is appropriate for the new step.

Also applies to: 41-41

vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1)

5-9: Scenario looks correct and robust.

Uses ${java.io.tmpdir}, writes the file there, and validates existence against the directory path.

vividus/src/test/java/org/vividus/steps/FileStepsTests.java (2)

90-136: Good negative-argument coverage with precise messages.

Null/empty/blank cases are verified and guarded with verifyNoMoreInteractions; concise and effective.


82-88: Remove the suggested change; the test is already correct.

FileUtils.writeStringToFile automatically creates the file's parent directories if they do not exist (this behavior has been in Commons‑IO since v1.3). The codebase uses commons-io 2.20.0, which is well after v1.3, so the test will create the "temp" parent directory without explicit intervention. The suggested createDirectories() call is unnecessary.

Likely an incorrect or invalid review comment.

docs/modules/commons/pages/vividus-steps.adoc (1)

460-467: Example reads well and matches the step behavior.

Uses ${java.io.tmpdir} and validates against the directory; good.

Comment thread docs/modules/commons/pages/vividus-steps.adoc Outdated
Comment thread docs/modules/commons/pages/vividus-steps.adoc Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
docs/modules/commons/pages/vividus-steps.adoc (1)

457-457: Fix incorrect parameter documentation: $filePath is the full file path, not a directory.

The documentation states "$filePath - The directory path where the file should exist", but this is incorrect. Based on the implementation, example, and past review feedback, $filePath should be the full path to the file (including the filename), not just the directory.

Apply this diff to correct the documentation:

-* `$filePath` - The directory path where the file should exist
+* `$filePath` - The full path to the file to check for existence

Based on past review comments.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebcb6d8 and feb6033.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (4 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (2)
vividus-tests/src/main/resources/story/integration/FileValidationSteps.story (1)

5-9: LGTM! Integration test correctly exercises the new file existence validation step.

The scenario properly initializes the test directory, creates a file, and verifies its existence using the full file path consistently.

docs/modules/commons/pages/vividus-steps.adoc (1)

459-466: LGTM! The example correctly demonstrates the file existence validation step.

The example properly shows initializing the directory variable, creating a file with content, and validating its existence using the full file path. This is consistent with the implementation and integration test.

Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java
Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b92d8d and 1034b55.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/File validation steps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (3 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: system-kafka-tests
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (macos-latest)

Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
vividus/src/main/java/org/vividus/steps/FileSteps.java (2)

42-43: Consider using constructor-based injection.

Both dependencies use field injection. Constructor-based injection is generally preferred as it provides better testability, immutability, and makes dependencies explicit.

Based on learnings (valfirst's comment).

Apply this refactor:

-    @Inject private VariableContext variableContext;
-    @Inject private ISoftAssert softAssert;
+    private final VariableContext variableContext;
+    private final ISoftAssert softAssert;
+
+    @Inject
+    public FileSteps(VariableContext variableContext, ISoftAssert softAssert)
+    {
+        this.variableContext = variableContext;
+        this.softAssert = softAssert;
+    }

84-87: Align Javadoc with documentation for clarity.

The Javadoc says "Checks if a file exists" but the documentation (line 450 of vividus-steps.adoc) more accurately states "Checks that a regular file exists at the given path." The distinction is important since directories would fail this check.

Based on learnings (valfirst's comment).

Apply this diff:

     /**
-     * Checks if a file exists at the given path
+     * Checks that a regular file exists at the given path
      * @param filePath The path where the file should exist
      */
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1034b55 and 269becc.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/File validation steps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (3 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
🔇 Additional comments (7)
vividus-tests/src/main/resources/story/integration/File validation steps.story (1)

1-8: LGTM!

The integration test story correctly validates the new file existence check. The scenario follows a clear pattern: initializes a file path, creates the file, and verifies its existence.

vividus/src/main/java/org/vividus/steps/FileSteps.java (1)

89-119: Well-structured implementation with comprehensive validation.

The method correctly handles all edge cases:

  • Null/blank path validation with early return
  • InvalidPathException handling with descriptive error messages
  • Clear distinction between "does not exist" and "is not a regular file" errors
  • Appropriate use of soft assertions for test reporting
docs/modules/commons/pages/vividus-steps.adoc (1)

448-465: Excellent documentation with clear examples.

The new "File existence validation" section is well-structured:

  • Clearly specifies "regular file" validation (distinguishing from directories)
  • Parameter description accurately indicates full path requirement
  • Example is practical and matches the integration test story
  • Consistent formatting with the rest of the document
vividus/src/test/java/org/vividus/steps/FileStepsTests.java (4)

54-58: Good use of constants for test maintainability.

The extracted constants improve readability and make it easier to maintain consistent test data across multiple test methods.


96-105: Excellent use of parameterized test for edge cases.

The parameterized test efficiently covers null, empty, and blank path scenarios in a single, maintainable test method.


107-116: Comprehensive validation of the happy path.

The test correctly verifies both the recorded assertion message and ensures no additional soft-assert interactions occur.


126-152: Thorough coverage of edge cases.

These tests effectively cover:

  • Directory paths that should fail the "regular file" check
  • Invalid paths that trigger InvalidPathException

The use of MockedStatic to simulate the exception is appropriate and demonstrates good testing practices.

Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
vividus/src/main/java/org/vividus/steps/FileSteps.java (1)

84-87: Address the unresolved review comment: align Javadoc with documentation.

The Javadoc should mention "regular file" to match the documentation and the actual behavior of the method (which uses Files.isRegularFile()).

Apply this diff to align the Javadoc:

     /**
-     * Checks if a file exists at the given path
+     * Checks that a regular file exists at the given path
      * @param filePath The path where the file should exist
      */
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 269becc and 0fe8e3d.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/File validation steps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (3 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: system-kafka-tests
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
🔇 Additional comments (8)
vividus-tests/src/main/resources/story/integration/File validation steps.story (1)

1-8: LGTM! Clear integration test for the new feature.

The integration story correctly demonstrates the file existence validation feature, using a temporary file path, creating the file, and asserting its existence. This provides good end-to-end coverage.

vividus/src/main/java/org/vividus/steps/FileSteps.java (1)

89-119: LGTM! Comprehensive validation logic.

The implementation correctly handles all edge cases:

  • Validates null/blank input with clear error message
  • Catches and reports InvalidPathException for malformed paths
  • Distinguishes between non-existent paths and non-regular files (directories)
  • Records appropriate passed/failed assertions

The logic is solid and aligns with the test coverage.

docs/modules/commons/pages/vividus-steps.adoc (1)

448-465: LGTM! Clear and accurate documentation.

The documentation correctly describes the new file existence validation feature:

  • Clearly states it checks for a "regular file" (not just any path)
  • Parameter description accurately specifies the full path including filename
  • Example is practical and demonstrates the feature correctly
vividus/src/test/java/org/vividus/steps/FileStepsTests.java (5)

22-64: LGTM! Well-organized test setup.

The new imports and constants are well-structured:

  • Necessary imports for parameterized tests and static mocking
  • Clear, reusable test constants
  • Proper mock declaration for ISoftAssert

69-94: LGTM! Good refactoring to use constants.

The existing tests have been updated to use the new constants (FILE_NAME, FILE_CONTENT), improving maintainability without changing test logic.


96-105: LGTM! Comprehensive parameterized test for invalid inputs.

The parameterized test efficiently covers null, empty, and blank path scenarios with proper verification of the soft assertion behavior and no unexpected interactions.


107-136: LGTM! Thorough coverage of path existence scenarios.

The tests comprehensively cover:

  • Regular file exists → passed assertion
  • Path does not exist → failed assertion with "does not exist" message
  • Path is a directory → failed assertion with "is not a regular file" message

Each test properly uses @TempDir, verifies the exact assertion message, and confirms no unexpected interactions.


138-153: LGTM! Effective test for exception handling.

The test cleverly uses MockedStatic to simulate InvalidPathException and verifies that the catch block properly records a failed assertion with the exception details. This completes the test coverage for all code paths.

Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Comment thread docs/modules/commons/pages/vividus-steps.adoc Outdated
Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java Outdated
Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66bd5c3 and 9f53e25.

📒 Files selected for processing (1)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (4)
vividus/src/test/java/org/vividus/steps/FileStepsTests.java (4)

55-59: LGTM!

The test constants are well-defined and improve test readability by avoiding string duplication.


64-65: LGTM!

The ISoftAssert mock is properly configured and all test methods correctly verify the soft assertion interactions as indicated in the past review comments.


109-138: LGTM!

The path existence validation tests comprehensively cover positive cases (file exists), negative cases (path doesn't exist), and edge cases (path is a directory). All softAssert interactions are properly verified with verifyNoMoreInteractions.


140-155: LGTM!

The use of MockedStatic<Path> to simulate InvalidPathException is an effective approach to test the exception handling path. The test properly verifies both the soft assertion behavior and the static method invocation.

Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java
Comment thread docs/modules/commons/pages/vividus-steps.adoc Outdated
Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Comment thread vividus/src/main/java/org/vividus/steps/FileSteps.java Outdated
Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed4aae3 and 7d8c48a.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/File validation steps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (3 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (9)
docs/modules/commons/pages/vividus-steps.adoc (1)

475-492: LGTM! Documentation is clear and complete.

The new file existence validation section is well-documented with clear parameter descriptions and a practical example. The documentation accurately reflects the implementation and provides users with sufficient information to use the step correctly.

vividus/src/main/java/org/vividus/steps/FileSteps.java (3)

1-36: LGTM! Imports and copyright properly updated.

The copyright year has been updated to 2025, and all new imports are necessary for the new file existence validation functionality.


39-48: Excellent implementation of constructor-based injection.

The migration from field injection to constructor injection follows best practices. The fields are properly marked as final, and the constructor cleanly initializes both dependencies. The new FILE constant promotes consistency in error messages.


89-117: Add test case and clarify whether directories should be accepted.

The method uses Files.exists(path) which returns true for any path type (files, directories, symlinks). However, the Javadoc and parameter example suggest regular files only. The test suite covers only regular files and has no test case for directories.

Either:

  1. Add a test confirming that directories should pass (and update the Javadoc to reflect this), or
  2. Use Files.isRegularFile(path) to reject directories and update the Javadoc accordingly.
vividus/src/test/java/org/vividus/steps/FileStepsTests.java (5)

1-62: LGTM! Test setup follows best practices.

The test class has been properly updated with constructor injection support, appropriate mocking of ISoftAssert, and well-defined constants for test data. The new imports support parameterized testing for comprehensive validation coverage.


64-89: LGTM! Existing tests properly refactored.

The existing test methods have been correctly updated to use the new constants, improving maintainability and reducing duplication. The exception handling in the lambda is appropriate.


91-101: LGTM! Comprehensive parameterized test for invalid inputs.

The parameterized test effectively covers null, empty, and blank path inputs, verifying that IllegalArgumentException is thrown with the correct message. This provides robust validation of the precondition checks.


103-122: Good test coverage for basic success and failure scenarios.

The tests properly verify both the success path (file exists) and failure path (file doesn't exist) with correct soft-assert interactions. The use of verifyNoMoreInteractions ensures no unexpected assertion calls occur.

Consider adding a test case to verify behavior when a directory path is provided, especially since Files.exists() returns true for directories. This would clarify the intended semantics and prevent regressions:

@Test
void testShouldPassOrFailWhenPathIsDirectory(@TempDir Path tempDir)
{
    Path directoryPath = tempDir.resolve("test-directory");
    Files.createDirectory(directoryPath);
    fileSteps.assertPathExists(directoryPath.toString());
    // Verify expected behavior: should it pass or fail for directories?
    verify(softAssert).recordPassedAssertion(...); // or recordFailedAssertion?
}

124-131: LGTM! Excellent test for invalid path handling.

The test effectively exercises the InvalidPathException catch block using a null byte character, which is universally invalid across platforms. The use of startsWith matcher appropriately handles platform-specific exception messages.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
vividus/src/main/java/org/vividus/steps/FileSteps.java (1)

110-117: Use Files.isRegularFile() to match the step's file-specific semantics.

The step is named "file exists at path" and the documentation states it "ensures that a file exists." However, Files.exists() returns true for directories, symbolic links, and other non-regular file types. This semantic mismatch could lead to false positives when a directory exists at the given path instead of a regular file.

Apply this diff to ensure the step validates regular files only and provides clear error messages:

-        if (!Files.exists(path))
+        if (!Files.exists(path))
         {
             softAssert.recordFailedAssertion(FILE + path + "' does not exist");
             return;
         }
-
-        softAssert.recordPassedAssertion(FILE + path + "' exists");
+        if (!Files.isRegularFile(path))
+        {
+            softAssert.recordFailedAssertion(FILE + path + "' exists but is not a regular file");
+            return;
+        }
+        softAssert.recordPassedAssertion(FILE + path + "' exists");

This change ensures that:

  1. Missing paths are reported as "does not exist"
  2. Directories and other non-regular paths are reported as "not a regular file"
  3. Only regular files pass the assertion
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d8c48a and bda5950.

📒 Files selected for processing (4)
  • docs/modules/commons/pages/vividus-steps.adoc (1 hunks)
  • vividus-tests/src/main/resources/story/integration/File validation steps.story (1 hunks)
  • vividus/src/main/java/org/vividus/steps/FileSteps.java (3 hunks)
  • vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: system-kafka-tests
🔇 Additional comments (5)
vividus/src/main/java/org/vividus/steps/FileSteps.java (2)

39-48: LGTM! Constructor injection implemented correctly.

The migration from field injection to constructor injection follows best practices. The FILE constant provides consistent messaging across assertions.


89-108: Input validation and exception handling are correct.

The validation logic properly handles null/empty/blank inputs using Validate.isTrue and catches InvalidPathException gracefully with clear error messages.

vividus/src/test/java/org/vividus/steps/FileStepsTests.java (3)

52-59: Good use of constants and proper mock setup.

The introduction of FILE_CONTENT and FILE_NAME constants eliminates duplication across tests. The ISoftAssert mock is properly configured for verifying assertion behavior.


91-101: Comprehensive validation test for null/empty/blank paths.

The parameterized test effectively covers all invalid input scenarios (null, empty, blank) and correctly expects IllegalArgumentException with the appropriate message.


124-131: Invalid path exception handling test is well-designed.

The test effectively triggers InvalidPathException using a null character and properly verifies the error message format and that no additional interactions occur.

Comment thread vividus/src/test/java/org/vividus/steps/FileStepsTests.java
@valfirst valfirst requested review from Copilot March 13, 2026 21:11
Copy link
Copy Markdown

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.

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to check that the file is downloaded and appears in the expected folder

3 participants