Merge remote-tracking branch 'remotes/origin/release/V3.0' into merge-3.1/RM-6892_SonarFixes

This commit is contained in:
cagache
2019-07-04 09:47:50 +03:00
270 changed files with 728 additions and 744 deletions

View File

@@ -83,7 +83,7 @@ public class HoldCapabilityConditionUnitTest extends BaseUnitTest
// setup test data
hold1 = generateNodeRef(TYPE_HOLD);
hold2 = generateNodeRef(TYPE_HOLD);
holds = new ArrayList<NodeRef>(2);
holds = new ArrayList<>(2);
holds.add(hold1);
holds.add(hold2);

View File

@@ -57,7 +57,7 @@ public class EagerContentStoreCleanerUnitTest extends BaseUnitTest
@InjectMocks private EagerContentStoreCleaner eagerContentStoreCleaner = new EagerContentStoreCleaner()
{
/** dummy implementation */
public boolean registerOrphanedContentUrl(String contentUrl, boolean force) {return true;};
public boolean registerOrphanedContentUrl(String contentUrl, boolean force) {return true;}
};
@Mock private ContentCleanser mockedContentCleanser;
@@ -89,7 +89,7 @@ public class EagerContentStoreCleanerUnitTest extends BaseUnitTest
public void contentRequiresCleaning()
{
String contentURL = AlfMock.generateText();
Set<Object> mockedSet = new HashSet<Object>(Arrays.asList(contentURL));
Set<Object> mockedSet = new HashSet<>(Arrays.asList(contentURL));
when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS))
.thenReturn(mockedSet);
@@ -119,7 +119,7 @@ public class EagerContentStoreCleanerUnitTest extends BaseUnitTest
public void contentDoesntRequireCleaning()
{
String contentURL = AlfMock.generateText();
Set<Object> mockedSet = new HashSet<Object>(Arrays.asList(contentURL));
Set<Object> mockedSet = new HashSet<>(Arrays.asList(contentURL));
when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS))
.thenReturn(mockedSet);

View File

@@ -51,7 +51,7 @@ public class ContentCleanser522022MUnitTest extends BaseUnitTest
@InjectMocks @Spy private ContentCleanser522022M contentCleanser522022M = new ContentCleanser522022M()
{
/** dummy implementations */
protected void overwrite(File file, OverwriteOperation overwriteOperation) {};
protected void overwrite(File file, OverwriteOperation overwriteOperation) {}
};
@Mock private File mockedFile;

View File

@@ -118,7 +118,7 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest
@Test
public void testDefaultFormValues()
{
List<FieldDefinition> defs = new ArrayList<FieldDefinition>(3);
List<FieldDefinition> defs = new ArrayList<>(3);
FieldDefinition idDef = mockFieldDefinition("rma:identifier");
defs.add(idDef);
FieldDefinition vrDef = mockFieldDefinition("rma:vitalRecordIndicator");
@@ -170,7 +170,7 @@ public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest
*/
private Map<QName, PropertyDefinition> mockPropertyDefintionMap(int size)
{
Map<QName, PropertyDefinition> properties = new HashMap<QName, PropertyDefinition>(size);
Map<QName, PropertyDefinition> properties = new HashMap<>(size);
for (int i = 0; i < size; i++)
{
QName name = generateQName(RM_URI);

View File

@@ -110,7 +110,7 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
public void heldByMultipleResults()
{
// setup record folder in multiple holds
List<ChildAssociationRef> holds = new ArrayList<ChildAssociationRef>(2);
List<ChildAssociationRef> holds = new ArrayList<>(2);
holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold, ASSOC_FROZEN_RECORDS, recordFolder, true, 1));
holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold2, ASSOC_FROZEN_RECORDS, recordFolder, true, 2));
doReturn(holds).when(mockedNodeService).getParentAssocs(recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS);
@@ -165,7 +165,7 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
public void getHeldWithResults()
{
// setup record folder in hold
List<ChildAssociationRef> holds = new ArrayList<ChildAssociationRef>(1);
List<ChildAssociationRef> holds = new ArrayList<>(1);
holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold, ASSOC_FROZEN_RECORDS, recordFolder, true, 1));
doReturn(holds).when(mockedNodeService).getChildAssocs(hold, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL);
@@ -352,7 +352,7 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
}).when(mockedNodeService).addAspect(any(NodeRef.class), eq(ASPECT_FROZEN), any(Map.class));
// build a list of holds
List<NodeRef> holds = new ArrayList<NodeRef>(2);
List<NodeRef> holds = new ArrayList<>(2);
holds.add(hold);
holds.add(hold2);
@@ -408,7 +408,7 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN);
// build a list of holds
List<NodeRef> holds = new ArrayList<NodeRef>(2);
List<NodeRef> holds = new ArrayList<>(2);
holds.add(hold);
holds.add(hold2);
@@ -425,7 +425,7 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
public void removeFromAllHolds()
{
// build a list of holds
List<NodeRef> holds = new ArrayList<NodeRef>(2);
List<NodeRef> holds = new ArrayList<>(2);
holds.add(hold);
holds.add(hold2);

View File

@@ -71,7 +71,7 @@ public class TransferEvaluatorUnitTest extends BaseUnitTest
private List<ChildAssociationRef> getParentAssocs(NodeRef provided)
{
List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>(1);
List<ChildAssociationRef> result = new ArrayList<>(1);
result.add(new ChildAssociationRef(ASSOC_TRANSFERRED, transfer, generateQName(), provided, false, 1));
return result;
}

View File

@@ -104,7 +104,7 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
public void testAddOneFolderTypeToRmSite()
{
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
ArrayList<ChildAssociationRef> assocs = new ArrayList<ChildAssociationRef>();
ArrayList<ChildAssociationRef> assocs = new ArrayList<>();
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo);
@@ -126,7 +126,7 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
public void testAddTwoFolderTypeToRmSite()
{
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
ArrayList<ChildAssociationRef> assocs = new ArrayList<ChildAssociationRef>();
ArrayList<ChildAssociationRef> assocs = new ArrayList<>();
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo);
@@ -155,12 +155,12 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
public void testAddMoreThanTwhoFolderTypeToRmSite()
{
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
ArrayList<ChildAssociationRef> assocs = new ArrayList<ChildAssociationRef>();
ArrayList<ChildAssociationRef> assocs = new ArrayList<>();
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo);
when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService);
when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(new ArrayList<ChildAssociationRef>());
when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(new ArrayList<>());
//create first folder
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FOLDER);
@@ -192,7 +192,7 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
public void testAddOneFilePlanTypeToRmSite()
{
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
ArrayList<ChildAssociationRef> assocs = new ArrayList<ChildAssociationRef>();
ArrayList<ChildAssociationRef> assocs = new ArrayList<>();
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo);
@@ -231,7 +231,7 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
public void testAddMoreThanOneFilePlanTypeToRmSite()
{
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
ArrayList<ChildAssociationRef> assocs = new ArrayList<ChildAssociationRef>();
ArrayList<ChildAssociationRef> assocs = new ArrayList<>();
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo);
@@ -260,7 +260,7 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
public void testAddOneDODFilePlanTypeToRmSite()
{
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true);
ArrayList<ChildAssociationRef> assocs = new ArrayList<ChildAssociationRef>();
ArrayList<ChildAssociationRef> assocs = new ArrayList<>();
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
when(mockedSiteInfo.getNodeRef()).thenReturn(rmSiteNodeRef);
@@ -287,7 +287,7 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
public void testAddMoreThanOneDODFilePlanTypeToRmSite()
{
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true);
ArrayList<ChildAssociationRef> assocs = new ArrayList<ChildAssociationRef>();
ArrayList<ChildAssociationRef> assocs = new ArrayList<>();
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
when(mockedSiteInfo.getNodeRef()).thenReturn(rmSiteNodeRef);

View File

@@ -109,7 +109,7 @@ public class RMv22RemoveInPlaceRolesFromAllPatchUnitTest extends BaseUnitTest
doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_READERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS);
doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_WRITERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS);
doReturn(ALL_ROLES).when(mockedFilePlanRoleService).getAllRolesContainerGroup(filePlan);
Set<String> contains = new HashSet<String>(2);
Set<String> contains = new HashSet<>(2);
contains.add(FilePlanRoleService.ROLE_EXTENDED_READERS);
contains.add(FilePlanRoleService.ROLE_EXTENDED_WRITERS);
doReturn(contains).when(mockedAuthorityService).getContainedAuthorities(null, ALL_ROLES, true);

View File

@@ -54,7 +54,7 @@ public class RecordMetadataBootstrapUnitTest extends BaseUnitTest
public void testInit()
{
// create and set map
Map<String, String> map = new HashMap<String, String>(2);
Map<String, String> map = new HashMap<>(2);
map.put("rma:test1", "rma:filePlan");
map.put("rma:test2", "rma:filePlan");
bootstrap.setRecordMetadataAspects(map);

View File

@@ -111,7 +111,7 @@ public class RecordedVersionConfigGetUnitTest extends BaseRecordedVersionConfigT
assertNotNull(recordableVersions);
assertEquals(recordableVersions.length(), 3);
List<RecordableVersionPolicy> policies = new ArrayList<RecordableVersionPolicy>();
List<RecordableVersionPolicy> policies = new ArrayList<>();
boolean isSelected = false;
int selectedOnce = 0;
for (int i = 0; i < recordableVersions.length(); i++)

View File

@@ -63,7 +63,7 @@ public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest
hold2NodeRef = generateHoldNodeRef("hold2");
// list of holds
holds = new ArrayList<NodeRef>(2);
holds = new ArrayList<>(2);
Collections.addAll(holds, hold1NodeRef, hold2NodeRef);
// list of records

View File

@@ -619,7 +619,7 @@ public class ExtendedSecurityServiceImplUnitTest
String writeGroup = writeGroupPrefix + "0";
// create fity results
List<String> fiftyResults = new ArrayList<String>(50);
List<String> fiftyResults = new ArrayList<>(50);
for (int i = 0; i < 50; i++)
{
fiftyResults.add(AlfMock.generateText());

View File

@@ -255,7 +255,7 @@ public class FilePlanPermissionServiceImplUnitTest extends BaseUnitTest
*/
private void setupPermissions(NodeRef nodeRef)
{
Set<AccessPermission> perms = new HashSet<AccessPermission>(4);
Set<AccessPermission> perms = new HashSet<>(4);
// setup basic file and read for authorities
perms.add(new AccessPermissionImpl(RMPermissionModel.READ_RECORDS, AccessStatus.ALLOWED, AUTHORITY, 0));

View File

@@ -201,7 +201,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
record = generateRecord();
// set record as child of record folder
List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>(1);
List<ChildAssociationRef> result = new ArrayList<>(1);
result.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, recordFolder, generateQName(RM_URI), record, true, 1));
doReturn(result).when(mockedNodeService).getChildAssocs(eq(recordFolder), eq(ContentModel.ASSOC_CONTAINS), any(QNamePattern.class));
doReturn(result).when(mockedNodeService).getParentAssocs(record);
@@ -376,7 +376,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
*/
protected void makeChildrenOf(NodeRef parent, NodeRef ... children)
{
List<ChildAssociationRef> assocs = new ArrayList<ChildAssociationRef>(children.length);
List<ChildAssociationRef> assocs = new ArrayList<>(children.length);
for (NodeRef child : children)
{
assocs.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parent, generateQName(), child));
@@ -388,7 +388,7 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel
@SuppressWarnings("unchecked")
protected <T> List<T> buildList(T ... values)
{
List<T> result = new ArrayList<T>(values.length);
List<T> result = new ArrayList<>(values.length);
for (T value : values)
{
result.add(value);

View File

@@ -99,7 +99,7 @@ public abstract class BaseWebScriptUnitTest extends BaseUnitTest
*/
protected Map<String, String> buildParameters(String ... values)
{
Map<String, String> result = new HashMap<String, String>(values.length/2);
Map<String, String> result = new HashMap<>(values.length / 2);
for (int i = 0; i < values.length; i=i+2)
{
String key = values[i];

View File

@@ -385,7 +385,7 @@ public class ExtendedVersionableAspectUnitTest implements RecordsManagementModel
// node is not being processed for versioning
when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS))
.thenReturn(new HashMap<NodeRef, NodeRef>(Collections.singletonMap(anotherNodeRef, anotherNodeRef)));
.thenReturn(new HashMap<>(Collections.singletonMap(anotherNodeRef, anotherNodeRef)));
// auto version false
when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION))

View File

@@ -103,7 +103,7 @@ public class RecordableVersionServiceImplUnitTest extends BaseUnitTest
nodeRef = generateCmContent(CONTENT_NAME);
doReturn(123l).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NODE_DBID);
versionProperties = new HashMap<String, Serializable>(5);
versionProperties = new HashMap<>(5);
recordableVersionService.initialise();

View File

@@ -73,15 +73,17 @@ public class ExtendedPermissionServiceImplUnitTest extends BaseUnitTest
/** permission service impl, default */
private @InjectMocks @Spy ExtendedPermissionServiceImpl extendedPermissionServiceImpl = new ExtendedPermissionServiceImpl()
{
protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; };
};
protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; }
};
/** permission service impl instance extended for reader/writer tests */
private @InjectMocks ExtendedPermissionServiceImpl extendedPermissionServiceImplWithReaderWritersSet = new ExtendedPermissionServiceImpl()
{
protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; };
public java.util.Set<String> getReaders(Long aclId) { return READERS; };
public java.util.Set<String> getWriters(Long aclId) { return WRITERS; };
protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; }
public java.util.Set<String> getReaders(Long aclId) { return READERS; }
public java.util.Set<String> getWriters(Long aclId) { return WRITERS; }
};
/** mocks */
@@ -270,7 +272,7 @@ public class ExtendedPermissionServiceImplUnitTest extends BaseUnitTest
// then
assertEquals(READERS, result.getFirst());
Set<String> writersWithOwner = new HashSet<String>(WRITERS);
Set<String> writersWithOwner = new HashSet<>(WRITERS);
writersWithOwner.add(OWNER);
assertEquals(writersWithOwner, result.getSecond());
}

View File

@@ -176,7 +176,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
when(mockedPatchDAO.getMaxAdmNodeID()).thenReturn(500000L);
// aspect
when(mockedQnameDAO.getQName(ASPECT_EXTENDED_SECURITY)).thenReturn(new Pair<Long, QName>(ASPECT_ID, ASPECT));
when(mockedQnameDAO.getQName(ASPECT_EXTENDED_SECURITY)).thenReturn(new Pair<>(ASPECT_ID, ASPECT));
}
/**
@@ -233,7 +233,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<Long, NodeRef>(i, nodeRef));
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef));
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true);
when(mockedNodeService.getProperty(nodeRef, PROP_READERS))
.thenReturn((Serializable) Collections.emptyMap());
@@ -279,7 +279,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<Long, NodeRef>(i, nodeRef));
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef));
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(false);
when(mockedNodeService.getProperty(nodeRef, PROP_READERS))
.thenReturn((Serializable) Collections.emptyMap());
@@ -380,7 +380,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<Long, NodeRef>(i, nodeRef));
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef));
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(false);
when(mockedNodeService.getProperty(nodeRef, PROP_READERS))
.thenReturn((Serializable) Collections.emptyMap());
@@ -408,7 +408,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<Long, NodeRef>(i, nodeRef));
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef));
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(false);
when(mockedNodeService.getProperty(nodeRef, PROP_READERS))
.thenReturn((Serializable) Collections.emptyMap());
@@ -437,7 +437,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<Long, NodeRef>(i, nodeRef));
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef));
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true);
when(mockedNodeService.getProperty(nodeRef, PROP_READERS)).thenReturn(null);
when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)).thenReturn(null);
@@ -487,7 +487,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<Long, NodeRef>(i, nodeRef));
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef));
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true);
when(mockedNodeService.getProperty(nodeRef, PROP_READERS))
.thenReturn((Serializable) Collections.emptyMap());
@@ -545,7 +545,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<Long, NodeRef>(i, nodeRef));
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef));
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true);
when(mockedNodeService.getProperty(nodeRef, PROP_READERS))
.thenReturn((Serializable) Collections.emptyMap());
@@ -586,7 +586,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<Long, NodeRef>(i, nodeRef));
when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef));
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true);
when(mockedNodeService.getProperty(nodeRef, PROP_READERS))
.thenReturn((Serializable) Collections.emptyMap());
@@ -650,7 +650,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
{
List<Long> ids = Stream.of(1l, 2l, 3l).collect(Collectors.toList());
NodeRef parentNodeRef = AlfMock.generateNodeRef(mockedNodeService);
List<FileInfo> children = new ArrayList<FileInfo>();
List<FileInfo> children = new ArrayList<>();
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true);
@@ -687,7 +687,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
{
List<Long> ids = Stream.of(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l).collect(Collectors.toList());
NodeRef parentNodeRef = AlfMock.generateNodeRef(mockedNodeService);
List<FileInfo> children = new ArrayList<FileInfo>();
List<FileInfo> children = new ArrayList<>();
ids.stream().forEach((i) -> {
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true);

View File

@@ -95,7 +95,7 @@ public class RMSiteEntityResourceUnitTest extends BaseUnitTest
rmSite.setDescription(RM_SITE_DESCRIPTION);
rmSite.setCompliance(RMSiteCompliance.STANDARD);
List<RMSite> entity = new ArrayList<RMSite>();
List<RMSite> entity = new ArrayList<>();
Params parameters = mock(Params.class);
entity.add(rmSite);
when(mockedRMSites.createRMSite(rmSite, parameters)).thenReturn(rmSite);