Skip to content

Commit

Permalink
[icalendar] Ensure DecimalType will be used if no unit given (openhab…
Browse files Browse the repository at this point in the history
…#9849)

Fixes openhab#9820
Related to openhab#9771

Signed-off-by: Christian Bandowski <[email protected]>
Signed-off-by: John Marshall <[email protected]>
  • Loading branch information
chris922 authored and themillhousegroup committed May 10, 2021
1 parent 7c00f3a commit ecffe08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.HSBType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.OpenClosedType;
Expand Down Expand Up @@ -45,9 +46,9 @@
@NonNullByDefault
public class CommandTag {

private static final List<Class<? extends Command>> otherCommandTypes = Arrays.asList(QuantityType.class,
OnOffType.class, OpenClosedType.class, UpDownType.class, HSBType.class, PlayPauseType.class,
RewindFastforwardType.class, StringType.class);
private static final List<Class<? extends Command>> otherCommandTypes = Arrays.asList(DecimalType.class,
QuantityType.class, OnOffType.class, OpenClosedType.class, UpDownType.class, HSBType.class,
PlayPauseType.class, RewindFastforwardType.class, StringType.class);

private static final List<Class<? extends Command>> percentCommandType = Arrays.asList(PercentType.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.HSBType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.OpenClosedType;
Expand Down Expand Up @@ -290,7 +291,7 @@ public void testCommandTagCode() {
// BEGIN:Calendar_Test_Number:12.3:abc
Command cmd3 = cmdTags.get(3).getCommand();
assertNotNull(cmd3);
assertEquals(QuantityType.class, cmd3.getClass());
assertEquals(DecimalType.class, cmd3.getClass());

// BEGIN:Calendar_Test_Temperature:12.3°C:abc
Command cmd4 = cmdTags.get(4).getCommand();
Expand Down Expand Up @@ -353,7 +354,7 @@ public void testCommandTagCode() {
// BEGIN:Calendar_Test_Number:-12.3:abc
cmd3 = cmdTags.get(3).getCommand();
assertNotNull(cmd3);
assertEquals(QuantityType.class, cmd3.getClass());
assertEquals(DecimalType.class, cmd3.getClass());

// BEGIN:Calendar_Test_Temperature:-12.3°C:abc
cmd4 = cmdTags.get(4).getCommand();
Expand Down Expand Up @@ -416,7 +417,7 @@ public void testCommandTagCode() {
// BEGIN:Calendar_Test_Number:-0:abc
cmd3 = cmdTags.get(3).getCommand();
assertNotNull(cmd3);
assertEquals(QuantityType.class, cmd3.getClass());
assertEquals(DecimalType.class, cmd3.getClass());

// BEGIN:Calendar_Test_Temperature:0K:abc
cmd4 = cmdTags.get(4).getCommand();
Expand Down Expand Up @@ -541,12 +542,12 @@ public void testCommandTagCode() {
// </p><p>BEGIN:Calendar_Test_Number:12.3:abc</p>
cmd6 = cmdTags.get(6).getCommand();
assertNotNull(cmd6);
assertEquals(QuantityType.class, cmd6.getClass());
assertEquals(DecimalType.class, cmd6.getClass());

// <p>END:Calendar_Test_Number:23.4:abc</p>
cmd7 = cmdTags.get(7).getCommand();
assertNotNull(cmd7);
assertEquals(QuantityType.class, cmd7.getClass());
assertEquals(DecimalType.class, cmd7.getClass());
}

@SuppressWarnings("null")
Expand Down

0 comments on commit ecffe08

Please sign in to comment.