Search in sources :

Example 1 with AuthorDto

use of org.eclipse.che.api.factory.shared.dto.AuthorDto in project che by eclipse.

the class FactoryEditValidatorImplTest method testUserIsNotTheAuthor.

/**
     * Check when user is not  same than the one than create the factory
     * @throws ApiException
     */
@Test(expectedExceptions = ForbiddenException.class)
public void testUserIsNotTheAuthor() throws ApiException {
    String userId = "florent";
    setCurrentUser(userId);
    AuthorDto author = mock(AuthorDto.class);
    doReturn(author).when(factory).getCreator();
    doReturn("john").when(author).getUserId();
    factoryEditValidator.validate(factory);
}
Also used : AuthorDto(org.eclipse.che.api.factory.shared.dto.AuthorDto) Test(org.testng.annotations.Test)

Example 2 with AuthorDto

use of org.eclipse.che.api.factory.shared.dto.AuthorDto in project che by eclipse.

the class FactoryEditValidatorImplTest method testUserIsTheAuthor.

/**
     * Check when user is the same than the one than create the factory
     * @throws ApiException
     */
@Test
public void testUserIsTheAuthor() throws ApiException {
    String userId = "florent";
    setCurrentUser(userId);
    AuthorDto author = mock(AuthorDto.class);
    doReturn(author).when(factory).getCreator();
    doReturn(userId).when(author).getUserId();
    factoryEditValidator.validate(factory);
}
Also used : AuthorDto(org.eclipse.che.api.factory.shared.dto.AuthorDto) Test(org.testng.annotations.Test)

Aggregations

AuthorDto (org.eclipse.che.api.factory.shared.dto.AuthorDto)2 Test (org.testng.annotations.Test)2