made some fields private
This commit is contained in:
parent
368530de97
commit
3dcfa584f0
2 changed files with 20 additions and 18 deletions
|
@ -8,6 +8,8 @@ import javax.validation.constraints.NotNull;
|
|||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class AutomationFastUpdateRequest {
|
||||
public abstract static class TriggerDTO {
|
||||
@NotNull public long deviceId;
|
||||
|
@ -28,8 +30,8 @@ public class AutomationFastUpdateRequest {
|
|||
}
|
||||
|
||||
public static class RangeTriggerDTO extends TriggerDTO {
|
||||
@NotNull public Operator operator;
|
||||
@NotNull public double range;
|
||||
@NotNull private Operator operator;
|
||||
@NotNull private double range;
|
||||
|
||||
@Override
|
||||
public Trigger<?> toModel() {
|
||||
|
@ -77,8 +79,8 @@ public class AutomationFastUpdateRequest {
|
|||
|
||||
public static class RangeConditionDTO extends ConditionDTO {
|
||||
|
||||
@NotNull public Operator operator;
|
||||
@NotNull public double range;
|
||||
@NotNull private Operator operator;
|
||||
@NotNull private double range;
|
||||
|
||||
@Override
|
||||
public Condition<?> toModel() {
|
||||
|
@ -92,8 +94,8 @@ public class AutomationFastUpdateRequest {
|
|||
|
||||
public static class ThermostatConditionDTO extends ConditionDTO {
|
||||
|
||||
@NotNull public ThermostatCondition.Operator operator;
|
||||
@NotNull public Thermostat.Mode mode;
|
||||
@NotNull private ThermostatCondition.Operator operator;
|
||||
@NotNull private Thermostat.Mode mode;
|
||||
|
||||
@Override
|
||||
public Condition<?> toModel() {
|
||||
|
|
|
@ -32,13 +32,13 @@ public class AutomationFastUpdateRequestTest {
|
|||
@DisplayName(" checking range trigger ")
|
||||
public void rangeTriggerDTOTest() {
|
||||
rangeTriggerDTO = new AutomationFastUpdateRequest.RangeTriggerDTO();
|
||||
rangeTriggerDTO.operator = Operator.EQUAL;
|
||||
rangeTriggerDTO.setOperator(Operator.EQUAL);
|
||||
rangeTriggerDTO.deviceId = 420;
|
||||
rangeTriggerDTO.range = 12;
|
||||
rangeTriggerDTO.setRange(12);
|
||||
|
||||
RangeTrigger rangeTrigger = (RangeTrigger) rangeTriggerDTO.toModel();
|
||||
assertEquals(rangeTrigger.getOperator(), rangeTriggerDTO.operator);
|
||||
assertEquals(rangeTrigger.getRange(), rangeTriggerDTO.range);
|
||||
assertEquals(rangeTrigger.getOperator(), rangeTriggerDTO.getOperator());
|
||||
assertEquals(rangeTrigger.getRange(), rangeTriggerDTO.getRange());
|
||||
assertEquals(rangeTrigger.getDeviceId(), rangeTriggerDTO.deviceId);
|
||||
}
|
||||
|
||||
|
@ -70,13 +70,13 @@ public class AutomationFastUpdateRequestTest {
|
|||
@DisplayName(" checking range condition ")
|
||||
public void rangeConditionDTOTest() {
|
||||
rangeConditionDTO = new AutomationFastUpdateRequest.RangeConditionDTO();
|
||||
rangeConditionDTO.operator = Operator.LESS;
|
||||
rangeConditionDTO.range = 82.01;
|
||||
rangeConditionDTO.setOperator(Operator.LESS);
|
||||
rangeConditionDTO.setRange(82.01);
|
||||
rangeConditionDTO.deviceId = 13;
|
||||
|
||||
RangeCondition rangeCondition = (RangeCondition) rangeConditionDTO.toModel();
|
||||
assertEquals(rangeCondition.getOperator(), rangeConditionDTO.operator);
|
||||
assertEquals(rangeCondition.getRange(), rangeConditionDTO.range);
|
||||
assertEquals(rangeCondition.getOperator(), rangeConditionDTO.getOperator());
|
||||
assertEquals(rangeCondition.getRange(), rangeConditionDTO.getRange());
|
||||
assertEquals(rangeCondition.getDeviceId(), rangeConditionDTO.deviceId);
|
||||
}
|
||||
|
||||
|
@ -85,13 +85,13 @@ public class AutomationFastUpdateRequestTest {
|
|||
public void thermostatConditionDTOTest() {
|
||||
thermostatConditionDTO = new AutomationFastUpdateRequest.ThermostatConditionDTO();
|
||||
thermostatConditionDTO.deviceId = 25;
|
||||
thermostatConditionDTO.operator = ThermostatCondition.Operator.EQUAL;
|
||||
thermostatConditionDTO.mode = Thermostat.Mode.HEATING;
|
||||
thermostatConditionDTO.setOperator(ThermostatCondition.Operator.EQUAL);
|
||||
thermostatConditionDTO.setMode(Thermostat.Mode.HEATING);
|
||||
|
||||
ThermostatCondition thermostatCondition =
|
||||
(ThermostatCondition) thermostatConditionDTO.toModel();
|
||||
assertEquals(thermostatCondition.getMode(), thermostatConditionDTO.mode);
|
||||
assertEquals(thermostatCondition.getOperator(), thermostatConditionDTO.operator);
|
||||
assertEquals(thermostatCondition.getMode(), thermostatConditionDTO.getMode());
|
||||
assertEquals(thermostatCondition.getOperator(), thermostatConditionDTO.getOperator());
|
||||
assertEquals(thermostatCondition.getDeviceId(), thermostatConditionDTO.deviceId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue