| | |
| | | when(tasks.getTaskListByProcessInstanceId("p",true)).thenReturn(List.of(task)); |
| | | assertThrows(ServiceException.class, () -> service.download(1,7)); |
| | | } |
| | | @Test void allowsManualApprovalByApplicant() throws Exception { |
| | | var buffer = new ByteArrayOutputStream(); |
| | | try (var zip = new ZipOutputStream(buffer)) { |
| | | zip.putNextEntry(new ZipEntry("word/media/seal.png")); |
| | | zip.write(new byte[]{1}); |
| | | zip.closeEntry(); |
| | | } |
| | | when(jdbc.queryForList(anyString(), any(Object[].class))).thenReturn(List.of(Map.of( |
| | | "process_instance_id", "p", "document_snapshot", buffer.toByteArray(), "seal_image", new byte[]{2}))); |
| | | HistoricTaskInstance task = mock(HistoricTaskInstance.class); |
| | | when(task.getAssignee()).thenReturn("7"); |
| | | when(task.getTaskLocalVariables()).thenReturn(Map.of("TASK_STATUS", 2, "TASK_REASON", "")); |
| | | when(tasks.getTaskListByProcessInstanceId("p", true)).thenReturn(List.of(task)); |
| | | assertNotNull(service.download(1, 7)); |
| | | } |
| | | @Test void approvedDownloadEmbedsSelectedImage() throws Exception { |
| | | var buffer=new ByteArrayOutputStream(); |
| | | try(var zip=new ZipOutputStream(buffer)){zip.putNextEntry(new ZipEntry("word/media/seal.png"));zip.write(new byte[]{1});zip.closeEntry();} |