eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
712 stars 455 forks source link

[EPIC] Migrate to Mockito mocking framework from JMockit in unit tests #857

Closed rohanKanojia closed 1 year ago

rohanKanojia commented 2 years ago

Description

Right now we're using JMockit in our tests for mocking the behavior of classes. We're discussed this in past as well but never got any chance to create an issue for this. We should try to move to Mockito which is a more modern mocking framework.

Goals

Since this can be a big task, I think we should try doing it step by step removing Jmockit from each module and using mockito instead. Here are the modules which use Jmockit:

We should try refactoring each of these modules one by one in order to achieve this migration.

praneethjreddy commented 2 years ago

@rohanKanojia, I have experience in writing unit tests using Mockito and would love to contribute to this migration. Thank you

rohanKanojia commented 2 years ago

@praneethjreddy : awesome, Thanks a lot. I wanted to get Marc's opinion on this one(He's on PTO right now and would be back next week). I think you can pick this up once he approves.

praneethjreddy commented 2 years ago

Sounds good

manusa commented 2 years ago

As we previously discussed, this is something we want to do. However, this can't be started until we merge the current work on Gradle Plugins. And also, individual issues should be open for classes, suites, modules or whatever we want to break down this task into. It would be too hard and would take too long to accomplish this in a single PR.

manusa commented 2 years ago

We should try to move to Mockito which is a more modern mocking framework.

Also, this is not the argument for switching to Mockito. For Gradle plugins we required some features specific to Mockito in order to keep things simple. In addition, the newer versions of Mockito don't require the use of PowerMock for special use cases and mock declaration is much more readable than JMockit. Since for Gradle we require Mockito and everything we have implemented using JMockit can be reimplemented with Mockito too, we should move everything to Mockito for consistency.

rohanKanojia commented 2 years ago

Umm, okay I'm fine with waiting till we merge feat/gradle-plugin into master branch. I thought we can take help from community members to achieve this since and resolving conflicts would not be that difficult even if we start now.

manusa commented 2 years ago

I thought we can take help from community members to achieve this since and resolving conflicts would not be that difficult even if we start now

Yes, sure, but we don't have the CQ approved for this and we will have some conflicts in the pom.xml since this is a new dependency (Mockito dependency was added in scope of #31). ----> It's hard maintaining a separate branch that affects completely separate modules, if we start adding changes to poms, it will get harder and harder.

In addition, just like we are doing with the Hamcrest to AssertJ replacement (e.g. #792) we need to create individual tasks for this, so that more than one contributor can work on the same goal at once.

halfdreamer commented 2 years ago

@rohanKanojia @manusa I'm interested in working on this. Can i go ahead and create a issues for any of the child module and start working on it ?

nabeelkhan10 commented 2 years ago

Hello, I want to contribute to open source and I found this project beginner friendly. Can anyone guide me?

rohanKanojia commented 2 years ago

@nabeelkhan10 : Sorry but @baruKreddy would be working on this Epic under Google Summer of Code this summer. If you want I can create some other good first issue for you.

rohanKanojia commented 2 years ago

@baruKreddy : Shall I assign this issue to you?

nabeelkhan10 commented 2 years ago

@nabeelkhan10 : Sorry but @baruKreddy would be working on this Epic under Google Summer of Code this summer. If you want I can create some other good first issue for you.

Yes that would be great

nabeelkhan10 commented 2 years ago

@baruKreddy : Shall I assign this issue to you? No brother thanks

baruKreddy commented 2 years ago

@rohanKanojia Sure assign this issue to me!

baruKreddy commented 2 years ago

Perhaps we can create sub issues/tasks under this PR to start working on @manusa @rohanKanojia.

manusa commented 2 years ago

Perhaps we can create sub issues/tasks under this PR to start working on @manusa @rohanKanojia.

Yes, we're working on this

nijicompany commented 1 year ago

hey there! I am a newbie here and I have used Eclipse a lot and still using it, after a long thought I finally decided to start contributing to open source and Eclipse will be my first. So guys please suggest to me how can I get started in contributing. Any help and resource will be much valuable to me. Thanks in advance

A6hishekSin9h commented 1 year ago

@rohanKanojia @manusa Hii! I am new to open-source contribution. I have sound knowledge of JAVA and IntelliJ and I have been using it since long. It would be really helpful if you guys could guide me and suggest me some good resources.

RoshanBro77 commented 1 year ago

@baruKreddy : Shall I assign this issue to you?

I also want to contribute as my first open source contribution can you assign me one too?

manusa commented 1 year ago

I believe this once can be closed now. @baruKreddy congrats for completing the project! Best of luck in your future endeavors, and I hope they involve in one way or another contributing to free/libre open source software :rocket:

Harshitchopde commented 5 months ago

Hello, I am newbie and wanted to contribute to this repository

rohanKanojia commented 5 months ago

@Harshitchopde : please look into issues tagged with good first issue label

Harshitchopde commented 5 months ago

@rohanKanojia Okay