Skip to content
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

Conversation

harshpreet08
Copy link
Contributor

Pull Request Summary

This pull request introduces a new test case in the ConfigurationTest class, validating the getEmbeddingDirectory 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!

This commit introduces a new test case to ensure that the getEmbeddingDirectory method in the Configuration class correctly creates the embedding directory path.
Copy link

codecov bot commented Dec 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (83d7aed) 97.11% compared to head (7e2632a) 98.27%.
Report is 16 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

File reportDirectory = new File("target");
Configuration configuration = new Configuration(reportDirectory, "myProject");

String expectedPath = new File(reportDirectory, "cucumber-html-reports" + File.separatorChar + "embeddings").getAbsolutePath();
Copy link
Owner

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

Copy link
Owner

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();
Copy link
Owner

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 +
Copy link
Owner

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

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.

2 participants