ACS-2606: ACS - migration Mockito version from 3.* to 4.* (#1146)

ACS-2606: ACS - migration Mockito version from 3.* to 4.*
This commit is contained in:
krdabrowski
2022-06-22 12:02:10 +02:00
committed by GitHub
parent a575fb2a76
commit 12455d37b6
43 changed files with 101 additions and 101 deletions

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -72,7 +72,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.context.ApplicationContext;
@@ -156,7 +156,7 @@ public class CalendarServiceImplTest
{
// Inject a mock to a real calendar service instead of tagging service
((CalendarServiceImpl) testContext.getBean("calendarService")).setTaggingService(TAGGING_SERVICE);
when(TAGGING_SERVICE.isTagScope(Matchers.any(NodeRef.class))).thenReturn(true);
when(TAGGING_SERVICE.isTagScope(ArgumentMatchers.any(NodeRef.class))).thenReturn(true);
}
@Test public void createNewEntry() throws Exception

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -75,7 +75,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.context.ApplicationContext;
@@ -161,7 +161,7 @@ public class DiscussionServiceImplTest
{
// Inject a mock to a real service instead of tagging service
((DiscussionServiceImpl) testContext.getBean("discussionService")).setTaggingService(TAGGING_SERVICE);
when(TAGGING_SERVICE.isTagScope(Matchers.any(NodeRef.class))).thenReturn(true);
when(TAGGING_SERVICE.isTagScope(ArgumentMatchers.any(NodeRef.class))).thenReturn(true);
}
@Test public void createNewTopic() throws Exception

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -64,7 +64,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.context.ApplicationContext;
@@ -140,7 +140,7 @@ public class LinksServiceImplTest
{
// Inject a mock to a real service instead of tagging service
((LinksServiceImpl) testContext.getBean("linksService")).setTaggingService(TAGGING_SERVICE);
when(TAGGING_SERVICE.isTagScope(Matchers.any(NodeRef.class))).thenReturn(true);
when(TAGGING_SERVICE.isTagScope(ArgumentMatchers.any(NodeRef.class))).thenReturn(true);
}
@Test public void createNewEntry() throws Exception

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -109,7 +109,7 @@ public class SolrQueryHTTPClientTest
when(namespaceDAO.getPrefixes()).thenReturn(Arrays.asList(CONTENT_MODEL_PREFIX, "exif"));
when(namespaceDAO.getNamespaceURI(anyString())).thenReturn(NamespaceService.CONTENT_MODEL_1_0_URI);
when(dictionaryService.getProperty(notNull(QName.class))).thenAnswer(invocation -> {
when(dictionaryService.getProperty(notNull())).thenAnswer(invocation -> {
Object[] args = invocation.getArguments();
QName qName = (QName) args[0];
if (qName.getLocalName().contains("created"))

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -46,7 +46,7 @@ import org.alfresco.util.BaseAlfrescoSpringTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.Matchers;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.springframework.transaction.annotation.Transactional;
@@ -97,12 +97,12 @@ public class ScriptTransferServiceTest extends BaseAlfrescoSpringTest
// When the transfer method is called return a node ref - mocks a good call.
// When the transfer method is called with a transfer name of exception - throw a transferException
Mockito.when(mockedTransferService.transfer(Matchers.anyString(), Matchers.isA(TransferDefinition.class))).thenReturn(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "123"));
Mockito.when(mockedTransferService.transfer(Matchers.eq("exception"), Matchers.isA(TransferDefinition.class))).thenThrow(new TransferException("mocked transfer exception"));
Mockito.when(mockedTransferService.transfer(ArgumentMatchers.anyString(), ArgumentMatchers.isA(TransferDefinition.class))).thenReturn(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "123"));
Mockito.when(mockedTransferService.transfer(ArgumentMatchers.eq("exception"), ArgumentMatchers.isA(TransferDefinition.class))).thenThrow(new TransferException("mocked transfer exception"));
// When getTransferTarget called return a TransferTarget
Mockito.when(mockedTransferService.getTransferTarget(Matchers.anyString())).thenReturn(dummyTarget);
Mockito.when(mockedTransferService.getTransferTargets(Matchers.anyString())).thenReturn(dummyTargets);
Mockito.when(mockedTransferService.getTransferTarget(ArgumentMatchers.anyString())).thenReturn(dummyTarget);
Mockito.when(mockedTransferService.getTransferTargets(ArgumentMatchers.anyString())).thenReturn(dummyTargets);
Mockito.when(mockedTransferService.getTransferTargets()).thenReturn(dummyTargets);
// Execute the unit test script