eclipse-jkube / jkube

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

SmallRyeHealthCheckEnricherTest : Replace `Mockito.mock` by creating actual object #3522

Closed rohanKanojia closed 1 week ago

rohanKanojia commented 2 weeks ago

Component

JKube Kit

Task description

Related to https://github.com/eclipse/jkube/issues/2316

SmallRyeHealthCheckEnricherTest seems to be using mock here :

https://github.com/eclipse-jkube/jkube/blob/2221e72fe51862f1043895ac02235f3e28e33e7b/jkube-kit/jkube-kit-smallrye/src/test/java/org/eclipse/jkube/smallrye/enricher/SmallRyeHealthCheckEnricherTest.java#L65-L66

This can easily be refactored to use real object using lombok builders:

      project = JavaProject.builder()
        // stuff to set in JavaProject 
        .build();
      context = GeneratorContext.builder()
        .project(project)
        .build();

Similarly these when( statements can also be replaced with builder calls like this:

https://github.com/eclipse-jkube/jkube/blob/2221e72fe51862f1043895ac02235f3e28e33e7b/jkube-kit/jkube-kit-smallrye/src/test/java/org/eclipse/jkube/smallrye/enricher/SmallRyeHealthCheckEnricherTest.java#L168-L172

javaProject = javaProject.toBuilder()
  .dependencies(Collections.singletonList(Dependency.builder()
        .groupId("io.smallrye")
        .artifactId("smallrye-health")
        .build()))
  .build();

Usage of org.mockito.Mockito.mock and org.mockito.Mockito.when is removed from SmallRyeHealthCheckEnricherTest

Expected Behavior

Usages of Mockito.mock and Mockito.when are removed from SmallRyeHealthCheckEnricherTest

Acceptance Criteria

saurabhmaurya1 commented 2 weeks ago

Hi @rohanKanojia , Please assign this task to me.

rohanKanojia commented 2 weeks ago

@saurabhmaurya1 first-timers-only tagged issues are created for newcomers who are contributing to the project for the first time so that they can complete legal requirements and get familiar with project.

Now that you’ve completed that step, I would advise you to look into issues tagged with good first issue / help wanted labels . Or maybe create some new issue if you find something that should be fixed.

saurabhmaurya1 commented 2 weeks ago

Thank you for the guidance, @rohanKanojia ! I’ll start looking into issues tagged with good first issue and help wanted to dive deeper into the project. I picked this issue because its not labeled as "first timers Only".

rohanKanojia commented 2 weeks ago

@saurabhmaurya1 : I'm sorry. I didn't notice that it's not a first timers only issue.