small changes

This commit is contained in:
omenem 2020-03-17 15:10:49 +01:00
parent 207e80c5f9
commit fe911d492f
2 changed files with 8 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
@ -15,7 +16,7 @@ public abstract class Dimmer extends InputDevice {
}
@OneToMany(mappedBy = "dimmer")
private Set<DimmableLight> lights;
private Set<DimmableLight> lights = new HashSet<>();
/**
* Get the lights connected to this dimmer
@ -26,4 +27,8 @@ public abstract class Dimmer extends InputDevice {
public Set<DimmableLight> getOutputs() {
return this.lights;
}
public void addDimmableLight(DimmableLight dimmableLight) {
lights.add(dimmableLight);
}
}

View file

@ -20,8 +20,8 @@ public class ButtonDimmerTests {
}
@Nested
@DisplayName(" when lights are present")
class lightsPresent {
@DisplayName(" when multiple lights are present")
class MultipleLights {
@BeforeEach
public void setLights() {