Use renamed Units class (#9267)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -24,7 +24,7 @@ import org.openhab.binding.luftdateninfo.internal.mock.ThingMock;
|
||||
import org.openhab.binding.luftdateninfo.internal.util.FileReader;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.SIUnits;
|
||||
import org.openhab.core.library.unit.SmartHomeUnits;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
|
||||
/**
|
||||
* The {@link ConditionHandlerTest} Test Condition Handler updates
|
||||
@@ -49,7 +49,7 @@ public class ConditionHandlerTest {
|
||||
UpdateStatus result = condHandler.updateChannels(pmJson);
|
||||
assertEquals(UpdateStatus.OK, result, "Valid update");
|
||||
assertEquals(QuantityType.valueOf(22.7, SIUnits.CELSIUS), condHandler.getTemperature(), "Temperature");
|
||||
assertEquals(QuantityType.valueOf(61.0, SmartHomeUnits.PERCENT), condHandler.getHumidity(), "Humidity");
|
||||
assertEquals(QuantityType.valueOf(61.0, Units.PERCENT), condHandler.getHumidity(), "Humidity");
|
||||
assertEquals(QuantityType.valueOf(-1, SIUnits.PASCAL), condHandler.getPressure(), "Pressure");
|
||||
assertEquals(QuantityType.valueOf(-1, SIUnits.PASCAL), condHandler.getPressureSea(), "Pressure Sea");
|
||||
} else {
|
||||
@@ -72,7 +72,7 @@ public class ConditionHandlerTest {
|
||||
UpdateStatus result = condHandler.updateChannels(pmJson);
|
||||
assertEquals(UpdateStatus.OK, result, "Valid update");
|
||||
assertEquals(QuantityType.valueOf(21.5, SIUnits.CELSIUS), condHandler.getTemperature(), "Temperature");
|
||||
assertEquals(QuantityType.valueOf(58.5, SmartHomeUnits.PERCENT), condHandler.getHumidity(), "Humidity");
|
||||
assertEquals(QuantityType.valueOf(58.5, Units.PERCENT), condHandler.getHumidity(), "Humidity");
|
||||
assertEquals(QuantityType.valueOf(100200.0, SIUnits.PASCAL), condHandler.getPressure(), "Pressure");
|
||||
assertEquals(QuantityType.valueOf(101968.7, SIUnits.PASCAL), condHandler.getPressureSea(), "Pressure Sea");
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.openhab.binding.luftdateninfo.internal.mock.NoiseHandlerExtension;
|
||||
import org.openhab.binding.luftdateninfo.internal.mock.ThingMock;
|
||||
import org.openhab.binding.luftdateninfo.internal.util.FileReader;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.SmartHomeUnits;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
|
||||
/**
|
||||
* The {@link NoiseHandlerTest} Test Noise Handler updates
|
||||
@@ -47,12 +47,9 @@ public class NoiseHandlerTest {
|
||||
if (pmJson != null) {
|
||||
UpdateStatus result = noiseHandler.updateChannels(pmJson);
|
||||
assertEquals(UpdateStatus.OK, result, "Valid update");
|
||||
assertEquals(QuantityType.valueOf(51.0, SmartHomeUnits.DECIBEL), noiseHandler.getNoiseEQCache(),
|
||||
"Noise EQ");
|
||||
assertEquals(QuantityType.valueOf(47.2, SmartHomeUnits.DECIBEL), noiseHandler.getNoiseMinCache(),
|
||||
"Noise Min");
|
||||
assertEquals(QuantityType.valueOf(57.0, SmartHomeUnits.DECIBEL), noiseHandler.getNoiseMaxCache(),
|
||||
"Noise Max");
|
||||
assertEquals(QuantityType.valueOf(51.0, Units.DECIBEL), noiseHandler.getNoiseEQCache(), "Noise EQ");
|
||||
assertEquals(QuantityType.valueOf(47.2, Units.DECIBEL), noiseHandler.getNoiseMinCache(), "Noise Min");
|
||||
assertEquals(QuantityType.valueOf(57.0, Units.DECIBEL), noiseHandler.getNoiseMaxCache(), "Noise Max");
|
||||
} else {
|
||||
assertTrue(false);
|
||||
}
|
||||
@@ -72,12 +69,9 @@ public class NoiseHandlerTest {
|
||||
if (pmJson != null) {
|
||||
UpdateStatus result = noiseHandler.updateChannels(pmJson);
|
||||
assertEquals(UpdateStatus.VALUE_ERROR, result, "Valid update");
|
||||
assertEquals(QuantityType.valueOf(-1, SmartHomeUnits.DECIBEL), noiseHandler.getNoiseEQCache(),
|
||||
"Values undefined");
|
||||
assertEquals(QuantityType.valueOf(-1, SmartHomeUnits.DECIBEL), noiseHandler.getNoiseMinCache(),
|
||||
"Values undefined");
|
||||
assertEquals(QuantityType.valueOf(-1, SmartHomeUnits.DECIBEL), noiseHandler.getNoiseMaxCache(),
|
||||
"Values undefined");
|
||||
assertEquals(QuantityType.valueOf(-1, Units.DECIBEL), noiseHandler.getNoiseEQCache(), "Values undefined");
|
||||
assertEquals(QuantityType.valueOf(-1, Units.DECIBEL), noiseHandler.getNoiseMinCache(), "Values undefined");
|
||||
assertEquals(QuantityType.valueOf(-1, Units.DECIBEL), noiseHandler.getNoiseMaxCache(), "Values undefined");
|
||||
} else {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.openhab.binding.luftdateninfo.internal.mock.PMHandlerExtension;
|
||||
import org.openhab.binding.luftdateninfo.internal.mock.ThingMock;
|
||||
import org.openhab.binding.luftdateninfo.internal.util.FileReader;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.SmartHomeUnits;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -111,10 +111,8 @@ public class PMHandlerTest {
|
||||
if (pmJson != null) {
|
||||
UpdateStatus result = pmHandler.updateChannels(pmJson);
|
||||
assertEquals(UpdateStatus.OK, result, "Valid update");
|
||||
assertEquals(QuantityType.valueOf(2.9, SmartHomeUnits.MICROGRAM_PER_CUBICMETRE), pmHandler.getPM25Cache(),
|
||||
"PM25");
|
||||
assertEquals(QuantityType.valueOf(5.2, SmartHomeUnits.MICROGRAM_PER_CUBICMETRE), pmHandler.getPM100Cache(),
|
||||
"PM100");
|
||||
assertEquals(QuantityType.valueOf(2.9, Units.MICROGRAM_PER_CUBICMETRE), pmHandler.getPM25Cache(), "PM25");
|
||||
assertEquals(QuantityType.valueOf(5.2, Units.MICROGRAM_PER_CUBICMETRE), pmHandler.getPM100Cache(), "PM100");
|
||||
} else {
|
||||
assertTrue(false);
|
||||
}
|
||||
@@ -134,9 +132,9 @@ public class PMHandlerTest {
|
||||
if (pmJson != null) {
|
||||
UpdateStatus result = pmHandler.updateChannels(pmJson);
|
||||
assertEquals(UpdateStatus.VALUE_ERROR, result, "Valid update");
|
||||
assertEquals(QuantityType.valueOf(-1, SmartHomeUnits.MICROGRAM_PER_CUBICMETRE), pmHandler.getPM25Cache(),
|
||||
assertEquals(QuantityType.valueOf(-1, Units.MICROGRAM_PER_CUBICMETRE), pmHandler.getPM25Cache(),
|
||||
"Values undefined");
|
||||
assertEquals(QuantityType.valueOf(-1, SmartHomeUnits.MICROGRAM_PER_CUBICMETRE), pmHandler.getPM100Cache(),
|
||||
assertEquals(QuantityType.valueOf(-1, Units.MICROGRAM_PER_CUBICMETRE), pmHandler.getPM100Cache(),
|
||||
"Values undefined");
|
||||
} else {
|
||||
assertTrue(false);
|
||||
|
||||
Reference in New Issue
Block a user