Search in sources :

Example 1 with ProjectRepository

use of com.epam.ta.reportportal.database.dao.ProjectRepository in project commons-dao by reportportal.

the class PersonalProjectServiceTest method mockProjectRepo.

private ProjectRepository mockProjectRepo() {
    ProjectRepository repo = Mockito.mock(ProjectRepository.class);
    when(repo.exists(Mockito.anyString())).thenReturn(false);
    return repo;
}
Also used : ProjectRepository(com.epam.ta.reportportal.database.dao.ProjectRepository)

Example 2 with ProjectRepository

use of com.epam.ta.reportportal.database.dao.ProjectRepository in project commons-dao by reportportal.

the class PersonalProjectServiceTest method personalProjectNameExisting.

@Test
public void personalProjectNameExisting() throws Exception {
    ProjectRepository repo = Mockito.mock(ProjectRepository.class);
    String userName = "John";
    when(repo.exists(Mockito.anyString())).then(invocation -> "john_personal".equals(invocation.getArguments()[0]));
    Assert.assertThat("Generated personal space name is incorrect", new PersonalProjectService(repo).generatePersonalProjectName(userName), Matchers.is("john_personal_1".toLowerCase()));
}
Also used : ProjectRepository(com.epam.ta.reportportal.database.dao.ProjectRepository) Test(org.junit.Test)

Aggregations

ProjectRepository (com.epam.ta.reportportal.database.dao.ProjectRepository)2 Test (org.junit.Test)1