@Test public void getPrintJobById_shouldReturnPrintJob() { PrintJob printJob = new PrintJob(); printJob.setId(2); printJob.setStatus(Status.COMPLETED); when(printJobRepo.findPrintJobById(anyInt())).thenReturn(printJob); DataResponse<BasicPrintJob> printJobResponse = operations.getPrintJobById(2); assertTrue("Print job is returned with id=2", printJobResponse.getData().get(0).getId() == 2); }
public DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId){ PrintJob printJob = printJobRepo.findPrintJobById(printJobId); if(printJob == null) throw new IdeaLabApiException(PRINT_JOB_CANT_FIND_BY_ID); List<PrintJob> printJobs = new ArrayList<>(); printJobs.add(printJob); DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>(); List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage("Print job returned successfully"); response.setHttpStatus(HttpStatus.ACCEPTED); response.setData(basicPrintJobs); return response; }
PrintJobOperations { public DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId){ PrintJob printJob = printJobRepo.findPrintJobById(printJobId); if(printJob == null) throw new IdeaLabApiException(PRINT_JOB_CANT_FIND_BY_ID); List<PrintJob> printJobs = new ArrayList<>(); printJobs.add(printJob); DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>(); List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage("Print job returned successfully"); response.setHttpStatus(HttpStatus.ACCEPTED); response.setData(basicPrintJobs); return response; } }
PrintJobOperations { public DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId){ PrintJob printJob = printJobRepo.findPrintJobById(printJobId); if(printJob == null) throw new IdeaLabApiException(PRINT_JOB_CANT_FIND_BY_ID); List<PrintJob> printJobs = new ArrayList<>(); printJobs.add(printJob); DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>(); List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage("Print job returned successfully"); response.setHttpStatus(HttpStatus.ACCEPTED); response.setData(basicPrintJobs); return response; } PrintJobOperations(FileService fileService, PrintJobRepo printJobRepo,
                              ColorTypeRepo colorTypeRepo, CustomerInfoRepo customerInfoRepo,
                              EmployeeRepo employeeRepo, EmailHashUtil emailHashUtil, QueueRepo queueRepo); }
PrintJobOperations { public DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId){ PrintJob printJob = printJobRepo.findPrintJobById(printJobId); if(printJob == null) throw new IdeaLabApiException(PRINT_JOB_CANT_FIND_BY_ID); List<PrintJob> printJobs = new ArrayList<>(); printJobs.add(printJob); DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>(); List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage("Print job returned successfully"); response.setHttpStatus(HttpStatus.ACCEPTED); response.setData(basicPrintJobs); return response; } PrintJobOperations(FileService fileService, PrintJobRepo printJobRepo,
                              ColorTypeRepo colorTypeRepo, CustomerInfoRepo customerInfoRepo,
                              EmployeeRepo employeeRepo, EmailHashUtil emailHashUtil, QueueRepo queueRepo); DataResponse<BasicPrintJob> newPrintJob(PrintJobNewRequest printJobNewRequest, Principal principal); DataResponse<BasicPrintJob> updateModel(Integer printId, PrintModelUpdateRequest model); GenericResponse deleteModel(Integer printId); GenericResponse updatePrintJobStatus(Integer printId, PrintJobUpdateRequest dto); GenericResponse deletePrintJob(PrintJobDeleteRequest dto); DataResponse<BasicPrintJob> getAllPrintJobs(String status); DataResponse<BasicPrintJob> getDeletablePrintJobs(); DataResponse<BasicPrintJob> updatePrintJobProps(Integer printJobId, UpdatePrintJobPropertiesRequest request); DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId); }
PrintJobOperations { public DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId){ PrintJob printJob = printJobRepo.findPrintJobById(printJobId); if(printJob == null) throw new IdeaLabApiException(PRINT_JOB_CANT_FIND_BY_ID); List<PrintJob> printJobs = new ArrayList<>(); printJobs.add(printJob); DataResponse<BasicPrintJob> response = new DataResponse<BasicPrintJob>(); List<BasicPrintJob> basicPrintJobs = new BasicPrintJob().ConvertPrintJobs(printJobs); response.setSuccess(true); response.setMessage("Print job returned successfully"); response.setHttpStatus(HttpStatus.ACCEPTED); response.setData(basicPrintJobs); return response; } PrintJobOperations(FileService fileService, PrintJobRepo printJobRepo,
                              ColorTypeRepo colorTypeRepo, CustomerInfoRepo customerInfoRepo,
                              EmployeeRepo employeeRepo, EmailHashUtil emailHashUtil, QueueRepo queueRepo); DataResponse<BasicPrintJob> newPrintJob(PrintJobNewRequest printJobNewRequest, Principal principal); DataResponse<BasicPrintJob> updateModel(Integer printId, PrintModelUpdateRequest model); GenericResponse deleteModel(Integer printId); GenericResponse updatePrintJobStatus(Integer printId, PrintJobUpdateRequest dto); GenericResponse deletePrintJob(PrintJobDeleteRequest dto); DataResponse<BasicPrintJob> getAllPrintJobs(String status); DataResponse<BasicPrintJob> getDeletablePrintJobs(); DataResponse<BasicPrintJob> updatePrintJobProps(Integer printJobId, UpdatePrintJobPropertiesRequest request); DataResponse<BasicPrintJob> getPrintJobById(Integer printJobId);  }