This repository has been archived by the owner on May 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
converting state types into accepted type before sending item state e…
…vents fixes #2253 Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
- Loading branch information
Simon Kaufmann
committed
Oct 31, 2016
1 parent
8d49d70
commit 057f76d
Showing
27 changed files
with
440 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...thome.core.test/src/test/java/org/eclipse/smarthome/core/library/types/OnOffTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2014-2016 by the respective copyright holders. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.smarthome.core.library.types; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* @author Simon Kaufmann - Initial contribution and API | ||
*/ | ||
public class OnOffTypeTest { | ||
|
||
@Test | ||
public void testConversionToPercentType() { | ||
assertEquals(PercentType.HUNDRED, OnOffType.ON.as(PercentType.class)); | ||
assertEquals(PercentType.ZERO, OnOffType.OFF.as(PercentType.class)); | ||
} | ||
|
||
@Test | ||
public void testConversionToDecimalType() { | ||
assertEquals(new DecimalType("1.0"), OnOffType.ON.as(DecimalType.class)); | ||
assertEquals(DecimalType.ZERO, OnOffType.OFF.as(DecimalType.class)); | ||
} | ||
|
||
@Test | ||
public void testConversionToHSBType() { | ||
assertEquals(HSBType.WHITE, OnOffType.ON.as(HSBType.class)); | ||
assertEquals(HSBType.BLACK, OnOffType.OFF.as(HSBType.class)); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
....core.test/src/test/java/org/eclipse/smarthome/core/library/types/OpenClosedTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (c) 2014-2016 by the respective copyright holders. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.smarthome.core.library.types; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* @author Simon Kaufmann - Initial contribution and API | ||
*/ | ||
public class OpenClosedTypeTest { | ||
|
||
@Test | ||
public void testConversionToPercentType() { | ||
assertEquals(PercentType.ZERO, OpenClosedType.CLOSED.as(PercentType.class)); | ||
assertEquals(PercentType.HUNDRED, OpenClosedType.OPEN.as(PercentType.class)); | ||
} | ||
|
||
@Test | ||
public void testConversionToDecimalType() { | ||
assertEquals(DecimalType.ZERO, OpenClosedType.CLOSED.as(DecimalType.class)); | ||
assertEquals(new DecimalType(1), OpenClosedType.OPEN.as(DecimalType.class)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...home.core.test/src/test/java/org/eclipse/smarthome/core/library/types/UpDownTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (c) 2014-2016 by the respective copyright holders. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.smarthome.core.library.types; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* @author Simon Kaufmann - Initial contribution and API | ||
*/ | ||
public class UpDownTypeTest { | ||
|
||
@Test | ||
public void testConversionToPercentType() { | ||
assertEquals(PercentType.ZERO, UpDownType.UP.as(PercentType.class)); | ||
assertEquals(PercentType.HUNDRED, UpDownType.DOWN.as(PercentType.class)); | ||
} | ||
|
||
@Test | ||
public void testConversionToDecimalType() { | ||
assertEquals(DecimalType.ZERO, UpDownType.UP.as(DecimalType.class)); | ||
assertEquals(new DecimalType(1), UpDownType.DOWN.as(DecimalType.class)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.