Upgrade Units of Measurement dependencies (#10583)
* Fix code/tests for upgrade * Resolve runbundles * Update Checkstyle ruleset for changed packages Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -14,6 +14,8 @@ package org.openhab.binding.http.internal.converter;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.measure.format.MeasurementParseException;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.http.internal.config.HttpChannelConfig;
|
||||
@@ -60,7 +62,7 @@ public class NumberItemConverter extends AbstractTransformingItemConverter {
|
||||
return new QuantityType<>(trimmedValue);
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException | MeasurementParseException e) {
|
||||
// finally failed
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ConverterTest {
|
||||
Assertions.assertEquals(new QuantityType<>(500, Units.WATT), converter.toState("500"));
|
||||
|
||||
// no valid value
|
||||
Assertions.assertEquals(UnDefType.UNDEF, converter.toState("100°C"));
|
||||
Assertions.assertEquals(UnDefType.UNDEF, converter.toState("100foo"));
|
||||
Assertions.assertEquals(UnDefType.UNDEF, converter.toState("foo"));
|
||||
Assertions.assertEquals(UnDefType.UNDEF, converter.toState(""));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user