added missing tests in scenePriority

This commit is contained in:
omenem 2020-05-25 10:40:43 +02:00
parent fa7fe5e8be
commit ea0361c384

View file

@ -1,6 +1,6 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models; package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
@ -39,4 +39,41 @@ public class ScenePriorityTests {
assertEquals(20, scenePriority.getPriority()); assertEquals(20, scenePriority.getPriority());
} }
@Test
@DisplayName("get and set automation")
public void getAndSetAutomation() {
Automation a = new Automation();
scenePriority.setAutomation(a);
assertEquals(a, scenePriority.getAutomation());
}
@Test
@DisplayName("get and set scene")
public void getAndSetScene() {
Scene s = new Scene();
scenePriority.setScene(s);
assertEquals(s, scenePriority.getScene());
}
@Test
@DisplayName("get and set scene")
public void testRemove() {
Scene s = new Scene();
scenePriority.setScene(s);
scenePriority.setSceneId(20L);
Automation a = new Automation();
scenePriority.setAutomation(a);
scenePriority.setAutomationId(20L);
scenePriority.preRemove();
assertNull(scenePriority.getAutomation());
assertNull(scenePriority.getAutomationId());
assertNull(scenePriority.getScene());
assertNull(scenePriority.getSceneId());
}
} }