SequentialReceiptNumberGenerator implements IReceiptNumberGenerator { @Override public String generateNumber(Bill bill) { if (bill == null) { throw new NullPointerException("The bill must be defined."); } LOG.debug("Generating receipt number for bill " + bill.getUuid() + "..."); String grouping = createGrouping(bill); String sequence = getSequence(grouping); String number = buildReceiptNumber(grouping, sequence); LOG.debug("Generated receipt number '" + number + "' for bill " + bill.getUuid() + "."); return number; } SequentialReceiptNumberGenerator(); @Override String getName(); @Override String getDescription(); @Override String getConfigurationPage(); @Override boolean isLoaded(); @Override void load(); @Override String generateNumber(Bill bill); String generateCheckDigit(String number);  }
@Test(expected = NullPointerException.class) public void generateNumber_shouldThrowNullPointerExceptionIfBillIsNull() throws Exception { generator.generateNumber(null); }