### Question:
WorkerService implements WorkerServiceI { @Override public Worker findWorkerByLogin(String login) throws BaseException { Worker worker = workerRepository.findWorkerByLogin(login); if (worker == null) { throw new WorkerDontExistsException("Issued worker dont exists"); } return worker; } @Inject  WorkerService(WorkerRepositoryI workerRepository); @Override Worker createWorker(Worker worker); @Override Worker editWorker(String login, Worker editedWorker); @Override Worker deleteWorker(String login); @Override Worker findWorkerByLogin(String login);  }### Answer:
@Test public void findWorker_Success() { try { Worker result = workerService.findWorkerByLogin(EXISTING_LOGIN); assertEquals(EXISTING_LOGIN, result.getLogin()); assertEquals(NAME, result.getName()); assertEquals(SURNAME, result.getSurname()); assertEquals(EMAIL, result.getEmail()); } catch (Exception e) { fail(String.format("Error in deleting worker: %s", e.getMessage())); } }
@Test(expected = WorkerDontExistsException.class) public void findWorker_WorkerDontExist() throws BaseException { workerService.findWorkerByLogin(NON_EXISTING_LOGIN); }