This commit is contained in:
omenem 2020-05-24 15:04:17 +02:00
parent ea8ac95b7a
commit d57a218fc9

View file

@ -1,4 +1,4 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.dimmableLightController; package ch.usi.inf.sa4.sanmarinoes.smarthut.controller;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
@ -8,18 +8,17 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import ch.usi.inf.sa4.sanmarinoes.smarthut.controller.DimmableLightController;
import ch.usi.inf.sa4.sanmarinoes.smarthut.dto.DimmableSaveRequest; import ch.usi.inf.sa4.sanmarinoes.smarthut.dto.DimmableSaveRequest;
import ch.usi.inf.sa4.sanmarinoes.smarthut.error.DuplicateStateException; import ch.usi.inf.sa4.sanmarinoes.smarthut.error.DuplicateStateException;
import ch.usi.inf.sa4.sanmarinoes.smarthut.error.NotFoundException; import ch.usi.inf.sa4.sanmarinoes.smarthut.error.NotFoundException;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DeviceRepository; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DeviceRepository;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DimmableLight; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DimmableLight;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DimmableLightRepository; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DimmableLightRepository;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DimmableState;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Scene; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Scene;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.SceneRepository; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.SceneRepository;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.State; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.State;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.StateRepository; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.StateRepository;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.SwitchableState;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.UserRepository; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.UserRepository;
import ch.usi.inf.sa4.sanmarinoes.smarthut.service.DeviceService; import ch.usi.inf.sa4.sanmarinoes.smarthut.service.DeviceService;
import ch.usi.inf.sa4.sanmarinoes.smarthut.utils.Utils; import ch.usi.inf.sa4.sanmarinoes.smarthut.utils.Utils;
@ -152,7 +151,7 @@ public class DimmableLightControllerTests {
.thenReturn(Optional.of(dimmableLight)); .thenReturn(Optional.of(dimmableLight));
Scene scene = new Scene(); Scene scene = new Scene();
scene.setId(1L); scene.setId(1L);
SwitchableState state = new SwitchableState(); DimmableState state = new DimmableState();
state.setSceneId(1L); state.setSceneId(1L);
State s = dimmableLight.cloneState(); State s = dimmableLight.cloneState();
when(sceneRepository.findById(1L)).thenReturn(Optional.of(scene)); when(sceneRepository.findById(1L)).thenReturn(Optional.of(scene));
@ -169,7 +168,7 @@ public class DimmableLightControllerTests {
.thenReturn(Optional.of(dimmableLight)); .thenReturn(Optional.of(dimmableLight));
Scene scene = new Scene(); Scene scene = new Scene();
scene.setId(1L); scene.setId(1L);
SwitchableState state = new SwitchableState(); DimmableState state = new DimmableState();
state.setSceneId(1L); state.setSceneId(1L);
State s = dimmableLight.cloneState(); State s = dimmableLight.cloneState();
when(sceneRepository.findById(1L)).thenReturn(Optional.of(scene)); when(sceneRepository.findById(1L)).thenReturn(Optional.of(scene));