@Test
public void getGenerator_shouldReturnTheCurrentlyDefinedReceiptNumberGenerator() throws Exception {

	// Configure system generator
	when(administrationService.getGlobalProperty(ModuleSettings.SYSTEM_RECEIPT_NUMBER_GENERATOR))
	        .thenReturn(TestReceiptNumberGenerator.class.getName());
	// Get the generator from the factory
	IReceiptNumberGenerator generator = ReceiptNumberGeneratorFactory.getGenerator();
	// Ensure that the correct generator was returned
	Assert.assertNotNull(generator);
	Assert.assertEquals(TestReceiptNumberGenerator.class, generator.getClass());
	// Get the generator again
	generator = ReceiptNumberGeneratorFactory.getGenerator();
	Assert.assertNotNull(generator);
	Assert.assertEquals(TestReceiptNumberGenerator.class, generator.getClass());
	// Ensure that the admin service was only called once
	verify(administrationService, times(1))
	        .getGlobalProperty(ModuleSettings.SYSTEM_RECEIPT_NUMBER_GENERATOR);
}