@Test
public void testExceptionWhenOperationNotAllowed() throws FunctionalException {

    // Prepare test
    final FunctionalException fe = new FunctionalException(FunctionalExceptionType.UNAUTHORIZED,
            ComponentType.WS_SMART_METERING);
    doThrow(fe).when(this.domainHelperService).isAllowed(this.organisation, this.device,
            DeviceFunction.REQUEST_PERIODIC_METER_DATA);
    // Run the test
    try {
        this.bundleService.enqueueBundleRequest(ORGANISATION_IDENTIFICATION, DEVICE_IDENTIFICATION,
                this.actionRequestMockList, MESSAGE_PRIORITY, BYPASS_RETRY);
        fail();
    } catch (final FunctionalException e) {
        // Verify the test
        assertEquals(fe, e);
    }
}