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

Refactor SystemMock utility in common-test to use mockito and use in GradleUtilTest to mock System properties #958

Open
rohanKanojia opened this issue Sep 30, 2021 · 3 comments
Assignees
Labels
🌞 GSoC Issues for the Google Summer of Code applicants

Comments

@rohanKanojia
Copy link
Member

Description

Blocked on #957 #857 #31

I was writing some tests related to System properties in #957 where SystemMock could be used for mocking System properties. Unfortunately, it's based on JMockit(as the rest of JKube Kit) and the Gradle Plugin module is based on Mockito.

We plan to Migrate JKube tests to Mockito in the future #857

Whenever we're able to merge Gradle module to main branch and migrate to Mockito. GradleUtilTest tests
which are using System.setProperty and then System.clearProperty should be updated to use SystemMock instead.

@rohanKanojia rohanKanojia changed the title Refactor SystemMock utility in commin-test to use mockito Refactor SystemMock utility in commin-test to use mockito and use in GradleUtilTest to mock System properties Sep 30, 2021
@manusa manusa changed the title Refactor SystemMock utility in commin-test to use mockito and use in GradleUtilTest to mock System properties Refactor SystemMock utility in common-test to use mockito and use in GradleUtilTest to mock System properties Nov 8, 2021
@rohanKanojia
Copy link
Member Author

rohanKanojia commented Jun 14, 2022

I think we might be able to deal with this using JUnit5 extensions. I see these options

After using these, there won't be a need of SystemMock anymore

@manusa
Copy link
Member

manusa commented Jun 15, 2022

I'd vote for our own extension. It won't be hard to implement and won't require additional dependencies.
Something as simple as an annotation to set a system property and an extension that would backup its original value and restore it for each test execution would be quite simple to implement.
Maybe in the scope of #857

@baruKreddy
Copy link
Contributor

please assign this to me and label it as GSoC @manusa @rohanKanojia

@rohanKanojia rohanKanojia added the 🌞 GSoC Issues for the Google Summer of Code applicants label Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌞 GSoC Issues for the Google Summer of Code applicants
Projects
None yet
Development

No branches or pull requests

3 participants