Search in sources :

Example 6 with UsersOptionsInterface

use of easytests.core.options.UsersOptionsInterface in project easy-tests by malinink.

the class UsersServiceTest method testDeleteWithOptions.

@Test
public void testDeleteWithOptions() throws Exception {
    final UserModelInterface userModel = Models.createUserModel(1, "FirstName", "LastName", "Surname", "email@gmail.com", "hash", true, 1);
    final UsersOptionsInterface usersOptions = Mockito.mock(UsersOptionsInterface.class);
    this.usersService.delete(userModel, usersOptions);
    verify(usersOptions).deleteWithRelations(userModel);
}
Also used : UserModelInterface(easytests.core.models.UserModelInterface) UsersOptionsInterface(easytests.core.options.UsersOptionsInterface)

Example 7 with UsersOptionsInterface

use of easytests.core.options.UsersOptionsInterface in project easy-tests by malinink.

the class UsersServiceTest method testFindAllWithOptions.

@Test
public void testFindAllWithOptions() throws Exception {
    final List<UserEntity> usersEntities = this.getUsersEntities();
    final List<UserModelInterface> usersModels = this.getUsersModels();
    final UsersOptionsInterface usersOptions = Mockito.mock(UsersOptionsInterface.class);
    given(this.usersMapper.findAll()).willReturn(usersEntities);
    given(usersOptions.withRelations(Mockito.anyList())).willReturn(usersModels);
    final List<UserModelInterface> foundedUsersModels = this.usersService.findAll(usersOptions);
    verify(usersOptions).withRelations(usersModels);
    Assert.assertEquals(usersModels, foundedUsersModels);
}
Also used : UserModelInterface(easytests.core.models.UserModelInterface) UsersOptionsInterface(easytests.core.options.UsersOptionsInterface) UserEntity(easytests.core.entities.UserEntity)

Example 8 with UsersOptionsInterface

use of easytests.core.options.UsersOptionsInterface in project easy-tests by malinink.

the class UsersServiceTest method testSaveWithOptions.

@Test
public void testSaveWithOptions() throws Exception {
    final UserModelInterface userModel = Models.createUserModel(null, "FirstName", "LastName", "Surname", "email@gmail.com", "hash", true, 1);
    final UsersOptionsInterface usersOptions = Mockito.mock(UsersOptionsInterface.class);
    this.usersService.save(userModel, usersOptions);
    verify(usersOptions).saveWithRelations(userModel);
}
Also used : UserModelInterface(easytests.core.models.UserModelInterface) UsersOptionsInterface(easytests.core.options.UsersOptionsInterface)

Aggregations

UsersOptionsInterface (easytests.core.options.UsersOptionsInterface)8 UserModelInterface (easytests.core.models.UserModelInterface)6 UserEntity (easytests.core.entities.UserEntity)3 UsersOptions (easytests.core.options.UsersOptions)2 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 SubjectsOptions (easytests.core.options.SubjectsOptions)1 SubjectsOptionsInterface (easytests.core.options.SubjectsOptionsInterface)1