Revision 45488
Added by Claudio Atzori about 7 years ago
NotificationDetectorImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.sn; |
2 | 2 |
|
3 |
import static org.junit.Assert.*; // NOPMD |
|
4 |
import static org.mockito.Mockito.*; // NOPMD |
|
5 |
|
|
6 | 3 |
import java.util.ArrayList; |
7 | 4 |
import java.util.List; |
8 |
|
|
9 | 5 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
10 | 6 |
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; |
11 | 7 |
|
8 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscription; |
|
9 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscriptionRegistry; |
|
10 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
|
12 | 11 |
import org.junit.Before; |
13 | 12 |
import org.junit.Test; |
14 | 13 |
import org.junit.runner.RunWith; |
15 | 14 |
import org.mockito.ArgumentMatcher; |
16 | 15 |
import org.mockito.Mock; |
17 |
import org.mockito.runners.MockitoJUnit44Runner;
|
|
16 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
18 | 17 |
|
19 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscription; |
|
20 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscriptionRegistry; |
|
21 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
|
18 |
import static org.junit.Assert.assertNotNull; |
|
19 |
import static org.mockito.Mockito.*; |
|
22 | 20 |
|
23 | 21 |
/** |
24 | 22 |
* Test the default notification detector implementation. |
... | ... | |
26 | 24 |
* @author marko |
27 | 25 |
* |
28 | 26 |
*/ |
29 |
@RunWith(MockitoJUnit44Runner.class)
|
|
27 |
@RunWith(MockitoJUnitRunner.class) |
|
30 | 28 |
public class NotificationDetectorImplTest { |
31 | 29 |
|
32 | 30 |
/** |
... | ... | |
45 | 43 |
* @author marko |
46 | 44 |
* |
47 | 45 |
*/ |
48 |
private final class CheckMessage extends ArgumentMatcher<NotificationMessage> {
|
|
46 |
private final class CheckMessage implements ArgumentMatcher<NotificationMessage> {
|
|
49 | 47 |
|
50 | 48 |
/** |
51 | 49 |
* prefix. |
... | ... | |
67 | 65 |
* @see org.mockito.ArgumentMatcher#matches(java.lang.Object) |
68 | 66 |
*/ |
69 | 67 |
@Override |
70 |
public boolean matches(final Object argument) { |
|
71 |
final NotificationMessage message = (NotificationMessage) argument; |
|
68 |
public boolean matches(final NotificationMessage message) { |
|
72 | 69 |
return message.getSubscriptionId() == subscription.getSubscriptionId() && message.getResourceId().equals("123") |
73 | 70 |
&& message.getTopic().equals(prefix + ".*.*"); |
74 | 71 |
} |
Also available in: Unified diff
using updated mockito version