@Test(expected = IOException.class) public void testRuntimeException() throws IOException { RuntimeException test = new RuntimeException("test"); DataPacketDto dataPacketDto = new DataPacketDto("test-data".getBytes(StandardCharsets.UTF_8)).putAttribute("key", "value"); objectMapper.writeValue(data, Arrays.stream(new DataPacketDto[]{dataPacketDto}).collect(Collectors.toList())); doThrow(test).when(transaction).send(any(DataPacket.class)); try { senderSupplier.get().sendFiles(); } catch (IOException e) { assertEquals(test, e.getCause()); throw e; } }
public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); }
SiteToSiteSender { public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); } }
SiteToSiteSender { public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); } SiteToSiteSender(SiteToSiteClient siteToSiteClient, InputStream input); }
SiteToSiteSender { public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); } SiteToSiteSender(SiteToSiteClient siteToSiteClient, InputStream input); TransactionCompletion sendFiles(); }
SiteToSiteSender { public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); } SiteToSiteSender(SiteToSiteClient siteToSiteClient, InputStream input); TransactionCompletion sendFiles();  }