-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Upgrade to new dependency mockito-testng #10647
Conversation
@@ -192,7 +191,8 @@ public void shouldDoNothingWhenTransportHttpReceived() throws Exception { | |||
* with help real children {@link TransportHttp}, which returns real not null | |||
* value. And then we can create mock {@link TransportHttp}. | |||
*/ | |||
mock(Transport.class); |
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.
Is this change needed in this PR?
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.
I guess yes. AFAIK @AndrienkoAleksandr was trying to explain why it needed in a comment about. New mockito just checking that mock is assigned to some variable and we can't just have mock in a vacuum.
@@ -225,7 +225,8 @@ public void testRethrowOnInvalidTokenBadRequestException() throws Exception { | |||
|
|||
@Test(expectedExceptions = {InfrastructureException.class}) | |||
public void testRethrowOnAnyException() throws Exception { | |||
when(keycloakServiceClient.getIdentityProviderToken(anyString())).thenThrow(Exception.class); |
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.
Can you elaborate on why we need this change? I don't see any connection with the purpose of the PR.
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.
With new mockito code should only throw checked exceptions that match the signature of the stubbed. In this case, that was not true.
@@ -357,7 +357,7 @@ public void stopsWaitingAllMachineStartWhenOneMachineStartFailed() throws Except | |||
final ImmutableMap<String, Pod> allPods = | |||
ImmutableMap.of(WORKSPACE_POD_NAME, mockPod(ImmutableList.of(container1, container2))); | |||
when(k8sEnv.getPods()).thenReturn(allPods); | |||
doThrow(InfrastructureException.class).when(bootstrapper).bootstrapAsync(); | |||
doThrow(IllegalStateException.class).when(bootstrapper).bootstrapAsync(); |
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.
Can you elaborate on why we need this change?
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.
With new mockito code should only throw checked exceptions that match the signature of the stubbed. In this case, that was not true.
@@ -378,7 +378,7 @@ public void throwsInfrastructureExceptionWhenErrorOccursAndCleanupFailed() throw | |||
doNothing().doThrow(InfrastructureException.class).when(namespace).cleanUp(); | |||
when(k8sEnv.getServices()).thenReturn(singletonMap("testService", mock(Service.class))); | |||
when(services.create(any())).thenThrow(new InfrastructureException("service creation failed")); | |||
doThrow(InfrastructureException.class).when(namespace).services(); |
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.
Can you elaborate on why we need this change? I don't see any connection with the purpose of the PR.
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.
same as two comments above. With new mockito code should only throw checked exceptions that match the signature of the stubbed. In this case, that was not true.
@skabashnyuk thank you for the explanation! |
ci-test |
Results of automated E2E tests of Eclipse Che Multiuser on OCP: |
ci-test |
Results of automated E2E tests of Eclipse Che Multiuser on OCP: |
ci-test |
Results of automated E2E tests of Eclipse Che Multiuser on OCP: |
ci-test |
Results of automated E2E tests of Eclipse Che Multiuser on OCP: |
MockitoTestNG runs with enabled Strict Stubbing rules, so tests were adjusted to that:
More info on how Strict Stubbing checking workes at: |
ci-test |
Results of automated E2E tests of Eclipse Che Multiuser on OCP: |
What does this PR do?
Upgrade to new dependency mockito-testng
Fixied issue in code related to this changes in mockito
Merge state
What issues does this PR fix or reference?
mockito/mockito#962
eclipse-che/che-parent#77
#10617
Upgrade to official mockito-testng artifact
Release Notes
Upgrade to official mockito-testng artifact
Docs PR
n/a