use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersController method delete.
@PostMapping("delete/{userId}/")
public String delete(@PathVariable Integer userId) {
this.getUserModel(userId);
final UsersOptionsInterface usersOptions = this.usersOptionsBuilder.forDelete();
final UserModelInterface userModel = this.usersService.find(userId, usersOptions);
this.usersService.delete(userModel, usersOptions);
return "redirect:/admin/users/";
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersOptionsTest method testWithSubjectsRelations.
@Test
public void testWithSubjectsRelations() throws Exception {
this.withUserModel().withSubjectsModelsFounded().withSubjects();
final UserModelInterface userModelWithRelations = this.usersOptions.withRelations(this.userModel);
Assert.assertSame(userModel, userModelWithRelations);
verify(this.subjectsService, times(1)).findByUser(this.userModel, this.subjectsOptions);
verify(this.userModel, times(1)).setSubjects(this.listCaptor.capture());
Assert.assertSame(this.subjectsModels, this.listCaptor.getValue());
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class SubjectsServiceTest method testFindByUserAbsentList.
@Test
public void testFindByUserAbsentList() throws Exception {
final UserModelInterface userModel = this.usersSupport.getModelFixtureMock(0);
when(this.subjectsMapper.findByUserId(userModel.getId())).thenReturn(new ArrayList<>(0));
final List<SubjectModelInterface> subjectsFoundedModels = this.subjectsService.findByUser(userModel);
Assert.assertEquals(0, subjectsFoundedModels.size());
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersServiceTest method testDeleteUnidentifiedModelTrowsException.
@Test
public void testDeleteUnidentifiedModelTrowsException() throws Exception {
final UserModelInterface userModel = this.usersSupport.getModelAdditionalMock(0);
exception.expect(DeleteUnidentifiedModelException.class);
this.usersService.delete(userModel);
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersServiceTest method testFindAbsentModel.
@Test
public void testFindAbsentModel() throws Exception {
final Integer id = 10;
final UserModelInterface userModel = this.usersService.find(id);
Assert.assertEquals(null, userModel);
}
Aggregations