@Test public void shouldGetRoleById() throws Exception { Role role = new Role(); Long roleId = 1L; when(roleRightsRepository.getRole(roleId)).thenReturn(role); assertThat(roleRightsService.getRole(roleId), is(role)); verify(roleRightsRepository).getRole(roleId); }