Thermostat

This commit is contained in:
omenem 2020-05-26 18:18:38 +02:00
parent 3e2eb231a0
commit e12163d2eb

View file

@ -2,6 +2,7 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Thermostat.Mode;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
@ -85,12 +86,34 @@ public class ThermostatTests {
assertEquals(new BigDecimal(42), thermostat.getInternalSensorTemperature()); assertEquals(new BigDecimal(42), thermostat.getInternalSensorTemperature());
} }
@Test
@DisplayName("test err ")
public void errTest() {
thermostat.setErr(BigDecimal.valueOf(10));
assertEquals(BigDecimal.valueOf(10), thermostat.getErr());
}
@Test
@DisplayName("test typical ")
public void typicalTest() {
thermostat.setTypical(BigDecimal.valueOf(10));
assertEquals(BigDecimal.valueOf(10), thermostat.getTypical());
}
@Test @Test
@DisplayName("test triggerState") @DisplayName("test triggerState")
public void testTriggerState() { public void testTriggerState() {
assertFalse(thermostat.readTriggerState()); assertFalse(thermostat.readTriggerState());
} }
@Test
@DisplayName("test triggerState")
public void testTriggerStateTrue() {
thermostat.setMode(Mode.COOLING);
assertTrue(thermostat.readTriggerState());
}
// for obvious reasons I am not gonna check all the possible combinations of toString() // for obvious reasons I am not gonna check all the possible combinations of toString()
@Test @Test
@DisplayName("test to string") @DisplayName("test to string")