@Test public void testInvalidMultiplicationFactor() throws FunctionalException { assertThatExceptionOfType(FunctionalException.class).isThrownBy(() -> { new SetRandomisationSettingsRequestData(SetRandomisationSettingsRequestData.MIN_VALUE_DIRECT_ATTACH, SetRandomisationSettingsRequestData.MAX_VALUE_RANDOMIZATION_START_WINDOW, SetRandomisationSettingsRequestData.MAX_VALUE_MULTIPLICATION_FACTOR + 1, SetRandomisationSettingsRequestData.MIN_VALUE_NUMBER_OF_RETRIES).validate(); }); }
@Override public void validate() throws FunctionalException { if (this.directAttach < MIN_VALUE_DIRECT_ATTACH || this.directAttach > MAX_VALUE_DIRECT_ATTACH) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("DirectAttach value range failed. (%s-%s)", MIN_VALUE_DIRECT_ATTACH, MAX_VALUE_DIRECT_ATTACH))); } if (this.randomisationStartWindow < MIN_VALUE_RANDOMIZATION_START_WINDOW || this.randomisationStartWindow > MAX_VALUE_RANDOMIZATION_START_WINDOW) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("RandomisationStartWindow value range failed. (%s-%s)", MIN_VALUE_RANDOMIZATION_START_WINDOW, MAX_VALUE_RANDOMIZATION_START_WINDOW))); } if (this.multiplicationFactor < MIN_VALUE_MULTIPLICATION_FACTOR || this.multiplicationFactor > MAX_VALUE_MULTIPLICATION_FACTOR) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("MultiplicationFactor value range failed. (%s-%s)", MIN_VALUE_MULTIPLICATION_FACTOR, MAX_VALUE_MULTIPLICATION_FACTOR))); } if (this.numberOfRetries < MIN_VALUE_NUMBER_OF_RETRIES || this.numberOfRetries > MAX_VALUE_NUMBER_OF_RETRIES) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception( String.format("NumberOfRetries value range failed. (%s-%s)", MIN_VALUE_NUMBER_OF_RETRIES, MAX_VALUE_NUMBER_OF_RETRIES))); } }
SetRandomisationSettingsRequestData implements Serializable, ActionRequest { @Override public void validate() throws FunctionalException { if (this.directAttach < MIN_VALUE_DIRECT_ATTACH || this.directAttach > MAX_VALUE_DIRECT_ATTACH) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("DirectAttach value range failed. (%s-%s)", MIN_VALUE_DIRECT_ATTACH, MAX_VALUE_DIRECT_ATTACH))); } if (this.randomisationStartWindow < MIN_VALUE_RANDOMIZATION_START_WINDOW || this.randomisationStartWindow > MAX_VALUE_RANDOMIZATION_START_WINDOW) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("RandomisationStartWindow value range failed. (%s-%s)", MIN_VALUE_RANDOMIZATION_START_WINDOW, MAX_VALUE_RANDOMIZATION_START_WINDOW))); } if (this.multiplicationFactor < MIN_VALUE_MULTIPLICATION_FACTOR || this.multiplicationFactor > MAX_VALUE_MULTIPLICATION_FACTOR) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("MultiplicationFactor value range failed. (%s-%s)", MIN_VALUE_MULTIPLICATION_FACTOR, MAX_VALUE_MULTIPLICATION_FACTOR))); } if (this.numberOfRetries < MIN_VALUE_NUMBER_OF_RETRIES || this.numberOfRetries > MAX_VALUE_NUMBER_OF_RETRIES) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception( String.format("NumberOfRetries value range failed. (%s-%s)", MIN_VALUE_NUMBER_OF_RETRIES, MAX_VALUE_NUMBER_OF_RETRIES))); } } }
SetRandomisationSettingsRequestData implements Serializable, ActionRequest { @Override public void validate() throws FunctionalException { if (this.directAttach < MIN_VALUE_DIRECT_ATTACH || this.directAttach > MAX_VALUE_DIRECT_ATTACH) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("DirectAttach value range failed. (%s-%s)", MIN_VALUE_DIRECT_ATTACH, MAX_VALUE_DIRECT_ATTACH))); } if (this.randomisationStartWindow < MIN_VALUE_RANDOMIZATION_START_WINDOW || this.randomisationStartWindow > MAX_VALUE_RANDOMIZATION_START_WINDOW) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("RandomisationStartWindow value range failed. (%s-%s)", MIN_VALUE_RANDOMIZATION_START_WINDOW, MAX_VALUE_RANDOMIZATION_START_WINDOW))); } if (this.multiplicationFactor < MIN_VALUE_MULTIPLICATION_FACTOR || this.multiplicationFactor > MAX_VALUE_MULTIPLICATION_FACTOR) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("MultiplicationFactor value range failed. (%s-%s)", MIN_VALUE_MULTIPLICATION_FACTOR, MAX_VALUE_MULTIPLICATION_FACTOR))); } if (this.numberOfRetries < MIN_VALUE_NUMBER_OF_RETRIES || this.numberOfRetries > MAX_VALUE_NUMBER_OF_RETRIES) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception( String.format("NumberOfRetries value range failed. (%s-%s)", MIN_VALUE_NUMBER_OF_RETRIES, MAX_VALUE_NUMBER_OF_RETRIES))); } } SetRandomisationSettingsRequestData(final int directAttach, final int randomisationStartWindow,
            final int multiplicationFactor, final int numberOfRetries); }
SetRandomisationSettingsRequestData implements Serializable, ActionRequest { @Override public void validate() throws FunctionalException { if (this.directAttach < MIN_VALUE_DIRECT_ATTACH || this.directAttach > MAX_VALUE_DIRECT_ATTACH) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("DirectAttach value range failed. (%s-%s)", MIN_VALUE_DIRECT_ATTACH, MAX_VALUE_DIRECT_ATTACH))); } if (this.randomisationStartWindow < MIN_VALUE_RANDOMIZATION_START_WINDOW || this.randomisationStartWindow > MAX_VALUE_RANDOMIZATION_START_WINDOW) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("RandomisationStartWindow value range failed. (%s-%s)", MIN_VALUE_RANDOMIZATION_START_WINDOW, MAX_VALUE_RANDOMIZATION_START_WINDOW))); } if (this.multiplicationFactor < MIN_VALUE_MULTIPLICATION_FACTOR || this.multiplicationFactor > MAX_VALUE_MULTIPLICATION_FACTOR) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("MultiplicationFactor value range failed. (%s-%s)", MIN_VALUE_MULTIPLICATION_FACTOR, MAX_VALUE_MULTIPLICATION_FACTOR))); } if (this.numberOfRetries < MIN_VALUE_NUMBER_OF_RETRIES || this.numberOfRetries > MAX_VALUE_NUMBER_OF_RETRIES) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception( String.format("NumberOfRetries value range failed. (%s-%s)", MIN_VALUE_NUMBER_OF_RETRIES, MAX_VALUE_NUMBER_OF_RETRIES))); } } SetRandomisationSettingsRequestData(final int directAttach, final int randomisationStartWindow,
            final int multiplicationFactor, final int numberOfRetries); @Override void validate(); int getDirectAttach(); int getRandomisationStartWindow(); int getMultiplicationFactor(); int getNumberOfRetries(); @Override DeviceFunction getDeviceFunction(); }
SetRandomisationSettingsRequestData implements Serializable, ActionRequest { @Override public void validate() throws FunctionalException { if (this.directAttach < MIN_VALUE_DIRECT_ATTACH || this.directAttach > MAX_VALUE_DIRECT_ATTACH) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("DirectAttach value range failed. (%s-%s)", MIN_VALUE_DIRECT_ATTACH, MAX_VALUE_DIRECT_ATTACH))); } if (this.randomisationStartWindow < MIN_VALUE_RANDOMIZATION_START_WINDOW || this.randomisationStartWindow > MAX_VALUE_RANDOMIZATION_START_WINDOW) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("RandomisationStartWindow value range failed. (%s-%s)", MIN_VALUE_RANDOMIZATION_START_WINDOW, MAX_VALUE_RANDOMIZATION_START_WINDOW))); } if (this.multiplicationFactor < MIN_VALUE_MULTIPLICATION_FACTOR || this.multiplicationFactor > MAX_VALUE_MULTIPLICATION_FACTOR) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception(String.format("MultiplicationFactor value range failed. (%s-%s)", MIN_VALUE_MULTIPLICATION_FACTOR, MAX_VALUE_MULTIPLICATION_FACTOR))); } if (this.numberOfRetries < MIN_VALUE_NUMBER_OF_RETRIES || this.numberOfRetries > MAX_VALUE_NUMBER_OF_RETRIES) { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new Exception( String.format("NumberOfRetries value range failed. (%s-%s)", MIN_VALUE_NUMBER_OF_RETRIES, MAX_VALUE_NUMBER_OF_RETRIES))); } } SetRandomisationSettingsRequestData(final int directAttach, final int randomisationStartWindow,
            final int multiplicationFactor, final int numberOfRetries); @Override void validate(); int getDirectAttach(); int getRandomisationStartWindow(); int getMultiplicationFactor(); int getNumberOfRetries(); @Override DeviceFunction getDeviceFunction();  }