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

Remove org.mockito references from EnricherConfigTest #2597

Closed
2 tasks done
rohanKanojia opened this issue Jan 31, 2024 · 1 comment · Fixed by #2604
Closed
2 tasks done

Remove org.mockito references from EnricherConfigTest #2597

rohanKanojia opened this issue Jan 31, 2024 · 1 comment · Fixed by #2604
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@rohanKanojia
Copy link
Member

rohanKanojia commented Jan 31, 2024

Component

JKube Kit

Task description

Description

Related to #2316

We have this simple test EnricherConfigTest that seems to be using mock for EnricherContext:
https://github.com/eclipse/jkube/blob/7561af9a2b36892b6c93863584d62d732e76938a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/api/EnricherConfigTest.java#L39

We are trying to make our tests more robust by replacing them with simple objects created using builders. We should refactor this test to not use mock.

This statement:
https://github.com/eclipse/jkube/blob/7561af9a2b36892b6c93863584d62d732e76938a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/api/EnricherConfigTest.java#L39

could be rewritten like this using builders:

    EnricherContext context = JKubeEnricherContext.builder()
        .project(JavaProject.builder()
            .groupId("org.eclipse.jkube")
            .artifactId("test-project")
            .version("0.0.1")
            .build())
        .processorConfig(new ProcessorConfig(null, null, configMap))
        .build();

Refactor this test to use builders instead of mock and when statements.

Also, this suppression doesn't seem to be applicable anymore, it's better to remove it :
https://github.com/eclipse/jkube/blob/7561af9a2b36892b6c93863584d62d732e76938a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/api/EnricherConfigTest.java#L36

Expected Behavior

mock and when statements are replaced by builders setting actual objects inside builder methods.

Acceptance Criteria

  • Use builder instead of mocking EnricherContext
  • Remove @SuppressWarnings("ResultOfMethodCallIgnored") annotation from test

Before you start 🔴

👇 👇 👇 👇 👇 👇 👇 👇 👇 👇👇👇👇👇👇👇

Make sure you read the contributing guide first. Pay special attention to the ECA agreement section and the requirement to sign-off your commit.

# (Optional): Configure Git User and Email
git config user.name "Your Name"
git config user.email "your_email@example.com"
@ShantKhatri
Copy link
Contributor

Can I work on this? Could you please assign this to me.

ShantKhatri added a commit to ShantKhatri/jkube that referenced this issue Feb 1, 2024
@manusa manusa added the help wanted Extra attention is needed label Feb 1, 2024
@manusa manusa added this to the 1.16.0 milestone Feb 1, 2024
manusa pushed a commit that referenced this issue Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
3 participants