-
Notifications
You must be signed in to change notification settings - Fork 523
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
Issue 3404 replace mockito with actual object in wildflyjarhealthcheckenrichertest #3416
Conversation
Eclipse JKube CI ReportStarted new GH workflow run for #3416 (2024-10-10T05:11:46Z) ⚙️ JKube E2E Tests (11261508645)
|
Hi @rohanKanojia, I’ve replaced the parts you suggested, but I'm facing challenges with replacing some Mockito.when statements with actual objects. Could you please guide me on how to proceed with these changes? LIKE Line 77 in dad4cc6
Lines 68 to 70 in dad4cc6
|
@ShivamChavan01 : You can convert an object to builder using context = context.toBuilder()
.processorConfig(c)
.build(); and similarly second pair of mocks can be converted like this: context = context.toBuilder()
.project(project.toBuilder()
.plugins(lst)
.build())
.processorConfig(c)
.build(); Could you please test these if they're working? |
.returns(initialDelay, Probe::getInitialDelaySeconds) | ||
.returns(failureThreshold, Probe::getFailureThreshold) | ||
.returns(successThreshold, Probe::getSuccessThreshold) | ||
.returns(periodSeconds, Probe::getPeriodSeconds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please revert these formatting changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Yeah I was formatting the code for some lines but it got effected I'll revert these changes
…heckEnricherTest class
@ShivamChavan01 : Build seems to be failing:
Could you please check these failures? |
…ith-actual-object-in-wildflyjarhealthcheckenrichertest
…actual-object-in-wildflyjarhealthcheckenrichertest' into issue-3404-replace-mockito-with-actual-object-in-wildflyjarhealthcheckenrichertest # Conflicts: # jkube-kit/jkube-kit-openliberty/src/test/java/org/eclipse/jkube/openliberty/OpenLibertyUtilsTest.java
Hey @rohanKanojia im getting these errors because of these lines in Lines 58 to 69 in dad4cc6
|
@ShivamChavan01 : Do you have installed Lombok plugin in your IntelliJ? |
I had previously installed the Lombok plugin, but since then, I've uninstalled it and reinstalled it. Unfortunately, I'm still encountering issues, and it hasn't resolved the problem. |
when(context.getProject()).thenReturn(project); | ||
when(context.getConfiguration()).thenReturn(configBuilder.build()); | ||
context = context.toBuilder() | ||
.project(project.toBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than creating a builder instance from member field project
you should create it from context itself so that you don't lose changes done in context.getProject()
after test setup
.project(project.toBuilder() | |
.project(context.getProject().toBuilder() |
when(context.getProject()).thenReturn(project); | ||
project = JavaProject.builder().build(); | ||
context = JKubeEnricherContext.builder() | ||
.project(context.getProject()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context is not initialized at this point.
.project(context.getProject()) | |
.project(project) |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx!
Description
Replaced Mockito.mock with actual object creation in WildflyJARHealthCheckEnricherTest
Fixes #3404
Type of change
test, version modification, documentation, etc.)
Checklist