Added Sensor
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user