SplitPages implements NextOutputStrategy { @Override public void ensureIsValid() throws TaskExecutionException { if (closingPages.isEmpty()) { throw new TaskExecutionException("Unable to split, no page number given."); } } SplitPages(Collection<Integer> pages);  SplitPages(Integer... pages); @Override void ensureIsValid(); @Override boolean isOpening(Integer page); @Override boolean isClosing(Integer page);  }
@Test(expected = TaskExecutionException.class) public void testFailingEnsureIsValid() throws TaskExecutionException { new SplitPages(new ArrayList<Integer>()).ensureIsValid(); }