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;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
public class AutomationFastUpdateRequest {
|
public class AutomationFastUpdateRequest {
|
||||||
public abstract static class TriggerDTO {
|
public abstract static class TriggerDTO {
|
||||||
@NotNull public long deviceId;
|
@NotNull public long deviceId;
|
||||||
|
@ -28,8 +30,8 @@ public class AutomationFastUpdateRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RangeTriggerDTO extends TriggerDTO {
|
public static class RangeTriggerDTO extends TriggerDTO {
|
||||||
@NotNull public Operator operator;
|
@NotNull private Operator operator;
|
||||||
@NotNull public double range;
|
@NotNull private double range;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Trigger<?> toModel() {
|
public Trigger<?> toModel() {
|
||||||
|
@ -77,8 +79,8 @@ public class AutomationFastUpdateRequest {
|
||||||
|
|
||||||
public static class RangeConditionDTO extends ConditionDTO {
|
public static class RangeConditionDTO extends ConditionDTO {
|
||||||
|
|
||||||
@NotNull public Operator operator;
|
@NotNull private Operator operator;
|
||||||
@NotNull public double range;
|
@NotNull private double range;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Condition<?> toModel() {
|
public Condition<?> toModel() {
|
||||||
|
@ -92,8 +94,8 @@ public class AutomationFastUpdateRequest {
|
||||||
|
|
||||||
public static class ThermostatConditionDTO extends ConditionDTO {
|
public static class ThermostatConditionDTO extends ConditionDTO {
|
||||||
|
|
||||||
@NotNull public ThermostatCondition.Operator operator;
|
@NotNull private ThermostatCondition.Operator operator;
|
||||||
@NotNull public Thermostat.Mode mode;
|
@NotNull private Thermostat.Mode mode;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Condition<?> toModel() {
|
public Condition<?> toModel() {
|
||||||
|
|
|
@ -32,13 +32,13 @@ public class AutomationFastUpdateRequestTest {
|
||||||
@DisplayName(" checking range trigger ")
|
@DisplayName(" checking range trigger ")
|
||||||
public void rangeTriggerDTOTest() {
|
public void rangeTriggerDTOTest() {
|
||||||
rangeTriggerDTO = new AutomationFastUpdateRequest.RangeTriggerDTO();
|
rangeTriggerDTO = new AutomationFastUpdateRequest.RangeTriggerDTO();
|
||||||
rangeTriggerDTO.operator = Operator.EQUAL;
|
rangeTriggerDTO.setOperator(Operator.EQUAL);
|
||||||
rangeTriggerDTO.deviceId = 420;
|
rangeTriggerDTO.deviceId = 420;
|
||||||
rangeTriggerDTO.range = 12;
|
rangeTriggerDTO.setRange(12);
|
||||||
|
|
||||||
RangeTrigger rangeTrigger = (RangeTrigger) rangeTriggerDTO.toModel();
|
RangeTrigger rangeTrigger = (RangeTrigger) rangeTriggerDTO.toModel();
|
||||||
assertEquals(rangeTrigger.getOperator(), rangeTriggerDTO.operator);
|
assertEquals(rangeTrigger.getOperator(), rangeTriggerDTO.getOperator());
|
||||||
assertEquals(rangeTrigger.getRange(), rangeTriggerDTO.range);
|
assertEquals(rangeTrigger.getRange(), rangeTriggerDTO.getRange());
|
||||||
assertEquals(rangeTrigger.getDeviceId(), rangeTriggerDTO.deviceId);
|
assertEquals(rangeTrigger.getDeviceId(), rangeTriggerDTO.deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,13 +70,13 @@ public class AutomationFastUpdateRequestTest {
|
||||||
@DisplayName(" checking range condition ")
|
@DisplayName(" checking range condition ")
|
||||||
public void rangeConditionDTOTest() {
|
public void rangeConditionDTOTest() {
|
||||||
rangeConditionDTO = new AutomationFastUpdateRequest.RangeConditionDTO();
|
rangeConditionDTO = new AutomationFastUpdateRequest.RangeConditionDTO();
|
||||||
rangeConditionDTO.operator = Operator.LESS;
|
rangeConditionDTO.setOperator(Operator.LESS);
|
||||||
rangeConditionDTO.range = 82.01;
|
rangeConditionDTO.setRange(82.01);
|
||||||
rangeConditionDTO.deviceId = 13;
|
rangeConditionDTO.deviceId = 13;
|
||||||
|
|
||||||
RangeCondition rangeCondition = (RangeCondition) rangeConditionDTO.toModel();
|
RangeCondition rangeCondition = (RangeCondition) rangeConditionDTO.toModel();
|
||||||
assertEquals(rangeCondition.getOperator(), rangeConditionDTO.operator);
|
assertEquals(rangeCondition.getOperator(), rangeConditionDTO.getOperator());
|
||||||
assertEquals(rangeCondition.getRange(), rangeConditionDTO.range);
|
assertEquals(rangeCondition.getRange(), rangeConditionDTO.getRange());
|
||||||
assertEquals(rangeCondition.getDeviceId(), rangeConditionDTO.deviceId);
|
assertEquals(rangeCondition.getDeviceId(), rangeConditionDTO.deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,13 +85,13 @@ public class AutomationFastUpdateRequestTest {
|
||||||
public void thermostatConditionDTOTest() {
|
public void thermostatConditionDTOTest() {
|
||||||
thermostatConditionDTO = new AutomationFastUpdateRequest.ThermostatConditionDTO();
|
thermostatConditionDTO = new AutomationFastUpdateRequest.ThermostatConditionDTO();
|
||||||
thermostatConditionDTO.deviceId = 25;
|
thermostatConditionDTO.deviceId = 25;
|
||||||
thermostatConditionDTO.operator = ThermostatCondition.Operator.EQUAL;
|
thermostatConditionDTO.setOperator(ThermostatCondition.Operator.EQUAL);
|
||||||
thermostatConditionDTO.mode = Thermostat.Mode.HEATING;
|
thermostatConditionDTO.setMode(Thermostat.Mode.HEATING);
|
||||||
|
|
||||||
ThermostatCondition thermostatCondition =
|
ThermostatCondition thermostatCondition =
|
||||||
(ThermostatCondition) thermostatConditionDTO.toModel();
|
(ThermostatCondition) thermostatConditionDTO.toModel();
|
||||||
assertEquals(thermostatCondition.getMode(), thermostatConditionDTO.mode);
|
assertEquals(thermostatCondition.getMode(), thermostatConditionDTO.getMode());
|
||||||
assertEquals(thermostatCondition.getOperator(), thermostatConditionDTO.operator);
|
assertEquals(thermostatCondition.getOperator(), thermostatConditionDTO.getOperator());
|
||||||
assertEquals(thermostatCondition.getDeviceId(), thermostatConditionDTO.deviceId);
|
assertEquals(thermostatCondition.getDeviceId(), thermostatConditionDTO.deviceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue