use of org.alfresco.bm.site.SiteData in project records-management by Alfresco.
the class RMBaseEventProcessorUnitTest method testGetUserWithNoRegisteredAdminRoleUser.
@Test(expected = IllegalStateException.class)
public void testGetUserWithNoRegisteredAdminRoleUser() throws Exception {
String userName = "user1";
Logger mockedLog = mock(Logger.class);
SiteData mockedSiteData = mock(SiteData.class);
when(mockedSiteDataService.getSite(PATH_SNIPPET_RM_SITE_ID)).thenReturn(mockedSiteData);
SiteMemberData mockedSiteMemberData = mock(SiteMemberData.class);
when(mockedSiteMemberData.getUsername()).thenReturn(userName);
when(mockedSiteDataService.randomSiteMember(PATH_SNIPPET_RM_SITE_ID, DataCreationState.Created, null, RMRole.Administrator.toString())).thenReturn(mockedSiteMemberData);
when(mockedUserDataService.findUserByUsername(userName)).thenReturn(null);
testRMBaseEventProcessor.getRandomUser(mockedLog);
}
use of org.alfresco.bm.site.SiteData in project records-management by Alfresco.
the class RMBaseEventProcessorUnitTest method testGetUserSuccessfull.
@Test
public void testGetUserSuccessfull() throws Exception {
String userName = "user1";
Logger mockedLog = mock(Logger.class);
SiteData mockedSiteData = mock(SiteData.class);
when(mockedSiteDataService.getSite(PATH_SNIPPET_RM_SITE_ID)).thenReturn(mockedSiteData);
SiteMemberData mockedSiteMemberData = mock(SiteMemberData.class);
when(mockedSiteMemberData.getUsername()).thenReturn(userName);
when(mockedSiteDataService.randomSiteMember(PATH_SNIPPET_RM_SITE_ID, DataCreationState.Created, null, RMRole.Administrator.toString())).thenReturn(mockedSiteMemberData);
UserData mockedUserData = mock(UserData.class);
when(mockedUserDataService.findUserByUsername(userName)).thenReturn(mockedUserData);
UserData user = testRMBaseEventProcessor.getRandomUser(mockedLog);
assertEquals(mockedUserData, user);
}
Aggregations