chore: migrate tests from JMock to Mockito#1814
Conversation
Replace JMock with Mockito in activemq-ra, activemq-unit-tests, and activemq-kahadb-store modules. Remove JMock dependencies from POMs.
jeanouii
left a comment
There was a problem hiding this comment.
Good to get rid of JMock and only rely on one mocking framework.
Some very very minimal details. Nothing to block the merge
| }}); | ||
|
|
||
| setupExpectRelease(); | ||
| doThrow(new ResourceException()).when(mockEndpointAndListener).beforeDelivery(any(Method.class)); |
There was a problem hiding this comment.
A few checks not ported here I believe
-
the 2 never in the checking block
verify(mockEndpointAndListener, never()).onMessage(any());
verify(mockEndpointAndListener, never()).afterDelivery(); -
the release in the setupExpectRelease() method
verify(mockEndpointAndListener).release();
|
|
||
| @Test(timeout = 60000) | ||
| public void testSuccessfulCallSequence() throws Exception { | ||
| setupBeforeDeliverySuccessful(); |
There was a problem hiding this comment.
Missing equivalents for this?
verify(mockEndpointAndListener).beforeDelivery(any(Method.class));
verify(mockEndpointAndListener).onMessage(stubMessage);
verify(mockEndpointAndListener).afterDelivery();
| }}); | ||
| doBeforeDeliveryExpectSuccess(); | ||
|
|
||
| setupAfterDeliverySuccessful(); |
There was a problem hiding this comment.
Missing the verify for Mockito
| import static org.mockito.Mockito.*; | ||
| import static org.mockito.ArgumentMatchers.*; | ||
|
|
||
| @Ignore |
There was a problem hiding this comment.
Outside of the scope of this PR. This test is @ignore, so you could have also remove it
Or fix it.
But that's fully equivalent
activemq-ra/src/test/java/org/apache/activemq/ra/ServerSessionImplTest.java
Show resolved
Hide resolved
activemq-ra/src/test/java/org/apache/activemq/ra/MessageEndpointProxyTest.java
Outdated
Show resolved
Hide resolved
activemq-ra/src/test/java/org/apache/activemq/ra/ServerSessionImplTest.java
Outdated
Show resolved
Hide resolved
- Replace star imports with explicit imports in MessageEndpointProxyTest - Add missing Mockito verify calls for all test methods to match original JMock expectations (never, release, successful calls) - Extract common mock setup into setupCommonMocks() helper in ServerSessionImplTest - Remove unused XAResource import
|
@jeanouii I think I addressed your comments. |
Replace JMock with Mockito in activemq-ra, activemq-unit-tests, and activemq-kahadb-store modules. Remove JMock dependencies from POMs.