Skip to content

Fixing failed unit tests which were trying to mock a static function #303

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

Merged
merged 1 commit into from
Aug 8, 2022
Merged

Fixing failed unit tests which were trying to mock a static function #303

merged 1 commit into from
Aug 8, 2022

Conversation

sanagaraj-pivotal
Copy link
Contributor

We move GitSupport. getLatestCommit() from member function to static function, some of the unit tests were mocking getLatestCommit() since mockito will not mock static functions all of the tests were failing, hence reverting getLatestCommit() from being static function to a member function.

@@ -47,7 +45,8 @@ void generateReportTest() throws IOException {
Path resultDir = RecipeIntegrationTestSupport.getResultDir(applicationDir);
String generatedReportContent = replaceDynamicPartsInReport(resultDir.resolve("Upgrade-Spring-Boot-2.4-to-2.5.html"), resultDir);

String revision = GitSupport.getLatestCommit(resultDir.toAbsolutePath().toFile()).get().getHash();
GitSupport gitSupport = new GitSupport(new SbmApplicationProperties());
Copy link
Contributor

Choose a reason for hiding this comment

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

This will disable the gitSupport fwir as the flag will be initialized with false here. I guess that's ok or maybe better.

@fabapp2 fabapp2 merged commit a83e788 into spring-projects-experimental:main Aug 8, 2022
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