-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test case for getEmbeddingDirectory in ConfigurationTest #1132
Add test case for getEmbeddingDirectory in ConfigurationTest #1132
Conversation
This commit introduces a new test case to ensure that the getEmbeddingDirectory method in the Configuration class correctly creates the embedding directory path.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1132 +/- ##
============================================
+ Coverage 97.11% 98.27% +1.15%
- Complexity 555 568 +13
============================================
Files 55 55
Lines 1212 1215 +3
Branches 106 105 -1
============================================
+ Hits 1177 1194 +17
+ Misses 20 10 -10
+ Partials 15 11 -4 ☔ View full report in Codecov by Sentry. |
File reportDirectory = new File("target"); | ||
Configuration configuration = new Configuration(reportDirectory, "myProject"); | ||
|
||
String expectedPath = new File(reportDirectory, "cucumber-html-reports" + File.separatorChar + "embeddings").getAbsolutePath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace with ReportBuilder.BASE_DIRECTORY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and Configuration.EMBEDDINGS_DIRECTORY
String expectedPath = new File(reportDirectory, "cucumber-html-reports" + File.separatorChar + "embeddings").getAbsolutePath(); | ||
|
||
// Act | ||
File embeddingDirectory = configuration.getEmbeddingDirectory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on the method name - this is not 'act'
Refactor the getEmbeddingDirectory test to improve readability and use constants ReportBuilder.BASE_DIRECTORY and configuration.getEmbeddingsDirectory for better maintainability. The test now follows the given-when-then structure, and the method name has been adjusted for clarity.
// given | ||
File reportDirectory = new File("target"); | ||
Configuration configuration = new Configuration(reportDirectory, "myProject"); | ||
String expectedPath = new File(reportDirectory, ReportBuilder.BASE_DIRECTORY + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you misunderstand how File works. It represents the abstract path it does not do what you write in method name above
https://docs.oracle.com/javase/8/docs/api/java/io/File.html
Pull Request Summary
This pull request introduces a new test case in the
ConfigurationTest
class, validating thegetEmbeddingDirectory
method. The test ensures that the method correctly creates the embedding directory path. This addition enhances the code coverage of the Configuration class.Please review the changes. Thank you!