EisCommonService { public User getUserForPosition(final Long posId, final Date givenDate) { try { List<Assignment> assignments = assignmentService.getAssignmentsForPosition(posId, givenDate); return assignments.isEmpty() ? null : assignments.get(0).getEmployee(); } catch (final Exception e) { throw new ApplicationRuntimeException("User Not Found", e); } }  @Deprecated Position getSuperiorPositionByObjectTypeAndPositionFrom(final Integer objectId, final Long posId); @Deprecated Position getSuperiorPositionByObjectAndObjectSubTypeAndPositionFrom(final Integer objectId,
                                                                               final String objectSubType, final Long posId); User getUserForPosition(final Long posId, final Date givenDate); @Deprecated Designation getEmployeeDesignation(final Long posId); Department getDepartmentForUser(final Long userId); @Deprecated Position getPositionByUserId(final Long userId); @Deprecated Assignment getLatestAssignmentForEmployee(final Long empId); @Deprecated Assignment getLatestAssignmentForEmployeeByToDate(final Long empId, final Date toDate); Assignment getLatestAssignmentForEmployeeByDate(final Long empId, final Date toDate); @Deprecated Position getPrimaryAssignmentPositionForEmp(final Long empId); @Deprecated Employee getPrimaryAssignmentEmployeeForPos(final Long posId); @Deprecated PersonalInformation getEmployeeByUserId(final Long userId); @Deprecated Boolean isHod(final Long assignId); @Deprecated Employee getEmployeeForPositionAndDate(final Long posId, final Date givenDate); List<User> getAllActiveUsersByGivenDesig(final Long designationId);  }
@Test public void getUserForPosition() { User usr = eisCommonService.getUserForPosition(1l, new Date()); assertEquals("egovernments",usr.getUsername()); }