/** * Overload that does not return anything * * @param action to perform in transaction */ public static void withinTransaction(final EntityManager em, final DoSomething action) throws Exception { withinTransaction( em, () -> { action.call(); return null; }); }
@Test public void shouldFilterResult() throws Exception { Optional<String> result = ds.list() .stream() .peek(System.out::println) .map(String::toUpperCase) .peek(System.out::println) .reduce((a, b) -> a + b); assertTrue(result.isPresent()); assertEquals(TEST, result.get()); }
@Test public void shouldReturnString() throws Exception { String result = ds.execute(() -> TEST); assertEquals(TEST, result); }