Revision 45488
Added by Claudio Atzori over 7 years ago
CompatPendingResourceManagerImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.registry; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertEquals; |
|
4 |
import static org.junit.Assert.assertNotNull; |
|
5 |
import static org.junit.Assert.assertNull; |
|
6 |
import static org.mockito.Matchers.anyObject; |
|
7 |
import static org.mockito.Matchers.anyString; |
|
8 |
import static org.mockito.Matchers.eq; |
|
9 |
import static org.mockito.Mockito.verify; |
|
10 |
import static org.mockito.Mockito.when; |
|
11 |
|
|
12 | 3 |
import javax.xml.xpath.XPathExpressionException; |
13 | 4 |
|
14 |
import org.junit.Before; |
|
15 |
import org.junit.Test; |
|
16 |
import org.junit.runner.RunWith; |
|
17 |
import org.mockito.Mock; |
|
18 |
import org.mockito.runners.MockitoJUnit44Runner; |
|
19 |
|
|
20 | 5 |
import eu.dnetlib.enabling.is.registry.schema.ValidationException; |
21 | 6 |
import eu.dnetlib.enabling.is.registry.validation.ProfileValidationStrategy; |
22 |
import eu.dnetlib.enabling.is.registry.validation.RegistrationPhase; |
|
23 | 7 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
24 | 8 |
import eu.dnetlib.rmi.enabling.ISRegistryException; |
25 | 9 |
import eu.dnetlib.rmi.enabling.ISRegistryService; |
10 |
import org.junit.Before; |
|
11 |
import org.junit.Test; |
|
12 |
import org.junit.runner.RunWith; |
|
13 |
import org.mockito.Mock; |
|
14 |
import org.mockito.junit.MockitoJUnitRunner; |
|
26 | 15 |
|
16 |
import static org.junit.Assert.*; |
|
17 |
import static org.mockito.ArgumentMatchers.anyString; |
|
18 |
import static org.mockito.Mockito.verify; |
|
19 |
import static org.mockito.Mockito.when; |
|
20 |
|
|
27 | 21 |
/** |
28 | 22 |
* test compatibility pending resource manager implementation. |
29 | 23 |
* |
30 | 24 |
* @author marko |
31 | 25 |
* |
32 | 26 |
*/ |
33 |
@RunWith(MockitoJUnit44Runner.class)
|
|
27 |
@RunWith(MockitoJUnitRunner.class) |
|
34 | 28 |
public class CompatPendingResourceManagerImplTest { |
35 | 29 |
|
36 | 30 |
/** |
... | ... | |
112 | 106 |
@Test |
113 | 107 |
public void testSetValid() throws ISRegistryException, ValidationException { |
114 | 108 |
final String profId = "123"; |
115 |
when(resource.getResourceId()).thenReturn("123");
|
|
116 |
when(profileValidationStrategy.accept((OpaqueResource) anyObject(), eq(RegistrationPhase.Register))).thenReturn(true);
|
|
109 |
when(resource.asString()).thenReturn("");
|
|
110 |
when(resource.getResourceId()).thenReturn(profId);
|
|
117 | 111 |
|
118 | 112 |
pendingManager.setValid(resource); |
119 | 113 |
|
... | ... | |
132 | 126 |
@Test |
133 | 127 |
public void testSetPending() throws ISRegistryException { |
134 | 128 |
final String profId = "321"; |
135 |
when(resource.getResourceId()).thenReturn("321"); |
|
129 |
when(resource.asString()).thenReturn(""); |
|
130 |
when(resource.getResourceId()).thenReturn(profId); |
|
136 | 131 |
when(resource.getResourceType()).thenReturn("RepositoryServiceResourceType"); |
137 | 132 |
|
138 | 133 |
pendingManager.setPending(resource); |
Also available in: Unified diff
using updated mockito version