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

AbstractMicroprofileHealthCheckEnricherTest : Replace `Mockito.mock` by creating actual object #3523

Open rohanKanojia opened 2 weeks ago

rohanKanojia commented 2 weeks ago

Component

JKube Kit

Task description

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

AbstractMicroprofileHealthCheckEnricherTest seems to be using mock here :

https://github.com/eclipse-jkube/jkube/blob/2221e72fe51862f1043895ac02235f3e28e33e7b/jkube-kit/jkube-kit-microprofile/src/test/java/org/eclipse/jkube/microprofile/enricher/AbstractMicroprofileHealthCheckEnricherTest.java#L68

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-microprofile/src/test/java/org/eclipse/jkube/microprofile/enricher/AbstractMicroprofileHealthCheckEnricherTest.java#L172-L175

javaProject = javaProject.toBuilder()
  .dependencies(Collections.singletonList(Dependency.builder()
        .groupId("org.example")
        .artifactId("microprofile-fooimpl")
        .build()))
  .build();

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

Expected Behavior

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

Acceptance Criteria

ShivamChavan01 commented 2 weeks ago

assign me @rohanKanojia

saurabhmaurya1 commented 1 week ago

Hi @ShivamChavan01, Are you still working on it? if not, then @rohanKanojia can you please assign this to me

ShivamChavan01 commented 1 week ago

@saurabhmaurya1 I'm working on it sorry, I was AFK for a while but I'll will be working on this issue at eve