Added Sensor

This commit is contained in:
Dawit Gulino 20013954
2018-06-05 14:51:40 +02:00
parent 4695b9ddfc
commit 7e1feb6939
4 changed files with 66 additions and 32 deletions

View File

@@ -2,22 +2,31 @@ import device.Hue;
import device.Sensor;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
public class TestSensor {
Sensor sensor = new Sensor();
Hue hue = new Hue();
public class TestSensor {
Sensor sensor = new Sensor(5);
Hue lights = new Hue();
@Test
public void firstTestSensor() {
assertTrue(sensor.IsLowLuminescence(50));
synchronized public void firstTestSensor() throws InterruptedException {
sensor.update(5);
System.out.println(sensor.luminiscenceLevel());
}
@Test
public void secondTestSensor() {
if(sensor.IsLowLuminescence(50)) {
hue.turnOn();
hue.setBrightness(200);
public void secondTestSensor() throws InterruptedException {
sensor.update(5);
Set<String> toRemove = new HashSet<>();
for(String str: lights.getNameLights())
if(!str.equals("4"))
toRemove.add(str);
lights.removeLights(toRemove);
if(sensor.luminiscenceLevel() < 100) {
lights.turnOn();
lights.setBrightness(200);
}
}
}