KnobDimmer Tests
This commit is contained in:
parent
5e7bd298de
commit
ce0edd7287
1 changed files with 46 additions and 0 deletions
|
@ -0,0 +1,46 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DimmableLight;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.KnobDimmer;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@DisplayName("A Knob Dimmer")
|
||||
public class KnobDimmerTests {
|
||||
|
||||
KnobDimmer knobDimmer;
|
||||
|
||||
@BeforeEach
|
||||
public void createNewKnobDimmer() {
|
||||
this.knobDimmer = new KnobDimmer();
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName(" when multiple lights are present")
|
||||
class MultipleLights {
|
||||
|
||||
@BeforeEach
|
||||
public void setLights() {
|
||||
DimmableLight dl;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
dl = new DimmableLight();
|
||||
dl.setIntensity(10);
|
||||
;
|
||||
knobDimmer.addDimmableLight(dl);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName(" set the intensity ")
|
||||
public void increase() {
|
||||
knobDimmer.setLightIntensity(30);
|
||||
for (DimmableLight dl : knobDimmer.getOutputs()) {
|
||||
assertEquals(30, dl.getIntensity());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue