diff --git a/bundles/org.openhab.core.audio/src/test/java/org/eclipse/smarthome/core/audio/internal/AudioServletTest.java b/bundles/org.openhab.core.audio/src/test/java/org/eclipse/smarthome/core/audio/internal/AudioServletTest.java index 4b34baca4..9604ac20b 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/eclipse/smarthome/core/audio/internal/AudioServletTest.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/eclipse/smarthome/core/audio/internal/AudioServletTest.java @@ -35,9 +35,9 @@ import org.junit.Test; */ public class AudioServletTest extends AbstractAudioServletTest { - private final String MEDIA_TYPE_AUDIO_WAV = "audio/wav"; - private final String MEDIA_TYPE_AUDIO_OGG = "audio/ogg"; - private final String MEDIA_TYPE_AUDIO_MPEG = "audio/mpeg"; + private static final String MEDIA_TYPE_AUDIO_WAV = "audio/wav"; + private static final String MEDIA_TYPE_AUDIO_OGG = "audio/ogg"; + private static final String MEDIA_TYPE_AUDIO_MPEG = "audio/mpeg"; private final byte[] testByteArray = new byte[] { 0, 1, 2 }; diff --git a/bundles/org.openhab.core.audio/src/test/java/org/eclipse/smarthome/core/audio/internal/fake/AudioSinkFake.java b/bundles/org.openhab.core.audio/src/test/java/org/eclipse/smarthome/core/audio/internal/fake/AudioSinkFake.java index 052a83c9b..9779e3123 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/eclipse/smarthome/core/audio/internal/fake/AudioSinkFake.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/eclipse/smarthome/core/audio/internal/fake/AudioSinkFake.java @@ -33,6 +33,7 @@ import org.eclipse.smarthome.core.library.types.PercentType; /** * An {@link AudioSink} fake used for the tests. * + * @author Petar Valchev - Initial contribution * @author Christoph Weitkamp - Added examples for getSupportedFormats() and getSupportedStreams() * @author Christoph Weitkamp - Added parameter to adjust the volume * @author Wouter Born - Migrate tests from Groovy to Java diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/resources/ESH-INF/automation/moduletypes/PrivateScriptedTypes.json b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/resources/ESH-INF/automation/moduletypes/PrivateScriptedTypes.json index 02db3bcc9..2529e85ce 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/resources/ESH-INF/automation/moduletypes/PrivateScriptedTypes.json +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/resources/ESH-INF/automation/moduletypes/PrivateScriptedTypes.json @@ -1,69 +1,69 @@ -{ - "conditions":[ - { - "uid":"jsr223.ScriptedCondition", - "label":"Scripted condition", - "description":"allows the definition of a condition by a script", - "visibility": "EXPERT", - "configDescriptions":[ - { - "name":"privId", - "type":"TEXT", - "description":"the identifier of the private method", - "required":true - } - ] - } - ], - "actions":[ - { - "uid":"jsr223.ScriptedAction", - "label":"Scripted action", - "description":"allows the execution of a method defined by a script", - "visibility": "EXPERT", - "configDescriptions":[ - { - "name":"privId", - "type":"TEXT", - "description":"the identifier of the private method", - "required":true - } - ], - "outputs":[ - { - "name":"result", - "type":"java.lang.Object", - "label":"result", - "description":"the script result.", - "reference":"" - } - ] - } - ], - "triggers": [ - { - "uid":"jsr223.ScriptedTrigger", - "label":"Scripted trigger", - "description":"allows the execution of a method defined by a script", - "visibility": "EXPERT", - "configDescriptions":[ - { - "name":"privId", - "type":"TEXT", - "description":"the identifier of the private method", - "required":true - } - ], - "outputs":[ - { - "name":"triggerOutput", - "type":"java.lang.String", - "label":"TriggerOutput label", - "description":"Text from the trigger", - "reference":"consoleInput", - "defaultValue":"dtag" - } - ] - } - ] +{ + "conditions": [ + { + "uid": "jsr223.ScriptedCondition", + "label": "Scripted condition", + "description": "allows the definition of a condition by a script", + "visibility": "EXPERT", + "configDescriptions": [ + { + "name": "privId", + "type": "TEXT", + "description": "the identifier of the private method", + "required": true + } + ] + } + ], + "actions": [ + { + "uid": "jsr223.ScriptedAction", + "label": "Scripted action", + "description": "allows the execution of a method defined by a script", + "visibility": "EXPERT", + "configDescriptions": [ + { + "name": "privId", + "type": "TEXT", + "description": "the identifier of the private method", + "required": true + } + ], + "outputs": [ + { + "name": "result", + "type": "java.lang.Object", + "label": "result", + "description": "the script result.", + "reference": "" + } + ] + } + ], + "triggers": [ + { + "uid": "jsr223.ScriptedTrigger", + "label": "Scripted trigger", + "description": "allows the execution of a method defined by a script", + "visibility": "EXPERT", + "configDescriptions": [ + { + "name": "privId", + "type": "TEXT", + "description": "the identifier of the private method", + "required": true + } + ], + "outputs": [ + { + "name": "triggerOutput", + "type": "java.lang.String", + "label": "TriggerOutput label", + "description": "Text from the trigger", + "reference": "consoleInput", + "defaultValue": "dtag" + } + ] + } + ] } diff --git a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ChannelTrigger.json b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ChannelTrigger.json index a1d916279..b42e6ebac 100644 --- a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ChannelTrigger.json +++ b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ChannelTrigger.json @@ -1,41 +1,41 @@ { - "triggers":[ - { - "uid":"core.ChannelEventTrigger", - "label":"a trigger channel fires", - "description":"React on events from a trigger channel of a thing.", - "configDescriptions":[ - { - "name":"channelUID", - "type":"TEXT", - "context":"channel", - "label":"Channel", - "description":"the id of the channel which should be observed for triggers", - "required":true, - "filterCriteria":[ - { - "value": "TRIGGER", - "name": "kind" - } - ] - }, - { - "name":"event", - "type":"TEXT", - "label":"Event", - "description":"the event on the channel to react on", - "required":false - } - ], - "outputs":[ - { - "name":"event", - "type":"org.eclipse.smarthome.core.events.Event", - "description":"the event of the channel trigger", - "label":"Event", - "reference":"channelEventTriggerId.event" - } - ] - } - ] + "triggers": [ + { + "uid": "core.ChannelEventTrigger", + "label": "a trigger channel fires", + "description": "React on events from a trigger channel of a thing.", + "configDescriptions": [ + { + "name": "channelUID", + "type": "TEXT", + "context": "channel", + "label": "Channel", + "description": "the id of the channel which should be observed for triggers", + "required": true, + "filterCriteria": [ + { + "value": "TRIGGER", + "name": "kind" + } + ] + }, + { + "name": "event", + "type": "TEXT", + "label": "Event", + "description": "the event on the channel to react on", + "required": false + } + ], + "outputs": [ + { + "name": "event", + "type": "org.eclipse.smarthome.core.events.Event", + "description": "the event of the channel trigger", + "label": "Event", + "reference": "channelEventTriggerId.event" + } + ] + } + ] } diff --git a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/GenericCronTrigger.json b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/GenericCronTrigger.json index 6bd60e81f..02ea766a0 100644 --- a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/GenericCronTrigger.json +++ b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/GenericCronTrigger.json @@ -1,19 +1,19 @@ -{ - "triggers":[ - { - "uid":"timer.GenericCronTrigger", - "label":"Cron Trigger", - "description":"This triggers a rule based on a cron expression", - "configDescriptions":[ - { - "name":"cronExpression", - "type":"TEXT", - "context":"cronexpression", - "label":"cron expression", - "description":"the cron expression", - "required":true - } - ] - } - ] +{ + "triggers": [ + { + "uid": "timer.GenericCronTrigger", + "label": "Cron Trigger", + "description": "This triggers a rule based on a cron expression", + "configDescriptions": [ + { + "name": "cronExpression", + "type": "TEXT", + "context": "cronexpression", + "label": "cron expression", + "description": "the cron expression", + "required": true + } + ] + } + ] } diff --git a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/GenericTriggers.json b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/GenericTriggers.json index 9bcafcf11..700d74889 100644 --- a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/GenericTriggers.json +++ b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/GenericTriggers.json @@ -1,45 +1,45 @@ { - "triggers":[ - { - "uid":"core.GenericEventTrigger", - "label":"Basic Event Trigger", - "description":"Triggers Rules on Events", - "visibility":"HIDDEN", - "configDescriptions":[ - { - "name":"eventTopic", - "type":"TEXT", - "label":"Topic", - "description":"This is the topic, the trigger will listen to: >>smarthome/*<<", - "required":true, - "default":"smarthome/*" - }, - { - "name":"eventSource", - "type":"TEXT", - "label":"Source", - "description":"This is the source of the event (eg. item name)", - "required":true, - "default":"" - }, - { - "name":"eventTypes", - "type":"TEXT", - "label":"Event Type", - "description":"the event type, the trigger should listen to. Multiple types can be specified comma-separated", - "required":true, - "default":"" - } - ], - "outputs":[ - { - "name":"event", - "type":"org.eclipse.smarthome.core.events.Event", - "label":"Event", - "description":"The events which was sent.", - "reference":"event" - } - ] - } - ] + "triggers": [ + { + "uid": "core.GenericEventTrigger", + "label": "Basic Event Trigger", + "description": "Triggers Rules on Events", + "visibility": "HIDDEN", + "configDescriptions": [ + { + "name": "eventTopic", + "type": "TEXT", + "label": "Topic", + "description": "This is the topic, the trigger will listen to: >>smarthome/*<<", + "required": true, + "default": "smarthome/*" + }, + { + "name": "eventSource", + "type": "TEXT", + "label": "Source", + "description": "This is the source of the event (eg. item name)", + "required": true, + "default": "" + }, + { + "name": "eventTypes", + "type": "TEXT", + "label": "Event Type", + "description": "the event type, the trigger should listen to. Multiple types can be specified comma-separated", + "required": true, + "default": "" + } + ], + "outputs": [ + { + "name": "event", + "type": "org.eclipse.smarthome.core.events.Event", + "label": "Event", + "description": "The events which was sent.", + "reference": "event" + } + ] + } + ] } diff --git a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ItemActions.json b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ItemActions.json index 682467670..42523fa82 100644 --- a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ItemActions.json +++ b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ItemActions.json @@ -1,61 +1,61 @@ -{ - "actions":[ - { - "uid":"core.ItemCommandAction", - "label":"send a command", - "description":"Sends a command to a specified item.", - "configDescriptions":[ - { - "name":"itemName", - "type":"TEXT", - "label":"Item", - "context":"item", - "description":"the name of the item", - "required":true - }, - { - "name":"command", - "type":"TEXT", - "label":"Command", - "description":"the default command to be sent if none is passed as an input value", - "required":true, - "limitToOptions":false, - "options":[ - { - "label": "ON", - "value": "ON" - }, - { - "label": "OFF", - "value": "OFF" - }, - { - "label": "OPEN", - "value": "OPEN" - }, - { - "label": "CLOSED", - "value": "CLOSED" - }, - { - "label": "UP", - "value": "UP" - }, - { - "label": "DOWN", - "value": "DOWN" - } - ] - } - ], - "inputs":[ - { - "name":"command", - "type":"command", - "label":"Command", - "description":"command that will be sent to the item." - } - ] - } - ] +{ + "actions": [ + { + "uid": "core.ItemCommandAction", + "label": "send a command", + "description": "Sends a command to a specified item.", + "configDescriptions": [ + { + "name": "itemName", + "type": "TEXT", + "label": "Item", + "context": "item", + "description": "the name of the item", + "required": true + }, + { + "name": "command", + "type": "TEXT", + "label": "Command", + "description": "the default command to be sent if none is passed as an input value", + "required": true, + "limitToOptions": false, + "options": [ + { + "label": "ON", + "value": "ON" + }, + { + "label": "OFF", + "value": "OFF" + }, + { + "label": "OPEN", + "value": "OPEN" + }, + { + "label": "CLOSED", + "value": "CLOSED" + }, + { + "label": "UP", + "value": "UP" + }, + { + "label": "DOWN", + "value": "DOWN" + } + ] + } + ], + "inputs": [ + { + "name": "command", + "type": "command", + "label": "Command", + "description": "command that will be sent to the item." + } + ] + } + ] } diff --git a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ItemTriggers.json b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ItemTriggers.json index 7a3e39628..a8324169f 100644 --- a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ItemTriggers.json +++ b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/ItemTriggers.json @@ -1,236 +1,236 @@ { - "triggers":[ - { - "uid":"core.ItemCommandTrigger", - "label":"an item receives a command", - "description":"This triggers the rule if an item receives a command.", - "configDescriptions":[ - { - "name":"itemName", - "type":"TEXT", - "context":"item", - "label":"Item", - "description":"the name of the item", - "required":true - }, - { - "name":"command", - "type":"TEXT", - "label":"Command", - "description":"the received command", - "required":false, - "limitToOptions":false, - "options":[ - { - "label": "ON", - "value": "ON" - }, - { - "label": "OFF", - "value": "OFF" - }, - { - "label": "OPEN", - "value": "OPEN" - }, - { - "label": "CLOSED", - "value": "CLOSED" - }, - { - "label": "UP", - "value": "UP" - }, - { - "label": "DOWN", - "value": "DOWN" - } - ] - } - ], - "outputs":[ - { - "name":"command", - "type":"command", - "description":"the received command", - "label":"Command" - }, - { - "name":"event", - "type":"org.eclipse.smarthome.core.events.Event", - "label":"Event", - "description":"The event which was sent.", - "reference":"event" - } - ] - }, - { - "uid":"core.ItemStateUpdateTrigger", - "label":"an item state is updated", - "description":"This triggers the rule if an item state is updated (even if it does not change).", - "configDescriptions":[ - { - "name":"itemName", - "type":"TEXT", - "context":"item", - "label":"Item", - "description":"the name of the item", - "required":true - }, - { - "name":"state", - "type":"TEXT", - "label":"State", - "description":"the state of the item", - "required":false, - "limitToOptions":false, - "options":[ - { - "label": "ON", - "value": "ON" - }, - { - "label": "OFF", - "value": "OFF" - }, - { - "label": "OPEN", - "value": "OPEN" - }, - { - "label": "CLOSED", - "value": "CLOSED" - }, - { - "label": "UP", - "value": "UP" - }, - { - "label": "DOWN", - "value": "DOWN" - } - ] - } - ], - "outputs":[ - { - "name":"state", - "type":"state", - "description":"the item state", - "label":"State" - }, - { - "name":"event", - "type":"org.eclipse.smarthome.core.events.Event", - "label":"Event", - "description":"The event which was sent.", - "reference":"event" - } - ] - }, - { - "uid":"core.ItemStateChangeTrigger", - "label":"an item state changes", - "description":"This triggers the rule if an item state has changed.", - "configDescriptions":[ - { - "name":"itemName", - "type":"TEXT", - "context":"item", - "label":"Item", - "description":"the name of the item", - "required":true - }, - { - "name":"previousState", - "type":"TEXT", - "label":"Previous State", - "description":"the required previous state of the item", - "required":false, - "limitToOptions":false, - "options":[ - { - "label": "ON", - "value": "ON" - }, - { - "label": "OFF", - "value": "OFF" - }, - { - "label": "OPEN", - "value": "OPEN" - }, - { - "label": "CLOSED", - "value": "CLOSED" - }, - { - "label": "UP", - "value": "UP" - }, - { - "label": "DOWN", - "value": "DOWN" - } - ] - }, - { - "name":"state", - "type":"TEXT", - "label":"State", - "description":"the state of the item", - "required":false, - "limitToOptions":false, - "options":[ - { - "label": "ON", - "value": "ON" - }, - { - "label": "OFF", - "value": "OFF" - }, - { - "label": "OPEN", - "value": "OPEN" - }, - { - "label": "CLOSED", - "value": "CLOSED" - }, - { - "label": "UP", - "value": "UP" - }, - { - "label": "DOWN", - "value": "DOWN" - } - ] - } - ], - "outputs":[ - { - "name":"newState", - "type":"state", - "description":"the new item state", - "label":"New State" - }, - { - "name":"oldState", - "type":"state", - "description":"the old item state", - "label":"Old State" - }, - { - "name":"event", - "type":"org.eclipse.smarthome.core.events.Event", - "label":"Event", - "description":"The event which was sent.", - "reference":"event" - } - ] - } - ] + "triggers": [ + { + "uid": "core.ItemCommandTrigger", + "label": "an item receives a command", + "description": "This triggers the rule if an item receives a command.", + "configDescriptions": [ + { + "name": "itemName", + "type": "TEXT", + "context": "item", + "label": "Item", + "description": "the name of the item", + "required": true + }, + { + "name": "command", + "type": "TEXT", + "label": "Command", + "description": "the received command", + "required": false, + "limitToOptions": false, + "options": [ + { + "label": "ON", + "value": "ON" + }, + { + "label": "OFF", + "value": "OFF" + }, + { + "label": "OPEN", + "value": "OPEN" + }, + { + "label": "CLOSED", + "value": "CLOSED" + }, + { + "label": "UP", + "value": "UP" + }, + { + "label": "DOWN", + "value": "DOWN" + } + ] + } + ], + "outputs": [ + { + "name": "command", + "type": "command", + "description": "the received command", + "label": "Command" + }, + { + "name": "event", + "type": "org.eclipse.smarthome.core.events.Event", + "label": "Event", + "description": "The event which was sent.", + "reference": "event" + } + ] + }, + { + "uid": "core.ItemStateUpdateTrigger", + "label": "an item state is updated", + "description": "This triggers the rule if an item state is updated (even if it does not change).", + "configDescriptions": [ + { + "name": "itemName", + "type": "TEXT", + "context": "item", + "label": "Item", + "description": "the name of the item", + "required": true + }, + { + "name": "state", + "type": "TEXT", + "label": "State", + "description": "the state of the item", + "required": false, + "limitToOptions": false, + "options": [ + { + "label": "ON", + "value": "ON" + }, + { + "label": "OFF", + "value": "OFF" + }, + { + "label": "OPEN", + "value": "OPEN" + }, + { + "label": "CLOSED", + "value": "CLOSED" + }, + { + "label": "UP", + "value": "UP" + }, + { + "label": "DOWN", + "value": "DOWN" + } + ] + } + ], + "outputs": [ + { + "name": "state", + "type": "state", + "description": "the item state", + "label": "State" + }, + { + "name": "event", + "type": "org.eclipse.smarthome.core.events.Event", + "label": "Event", + "description": "The event which was sent.", + "reference": "event" + } + ] + }, + { + "uid": "core.ItemStateChangeTrigger", + "label": "an item state changes", + "description": "This triggers the rule if an item state has changed.", + "configDescriptions": [ + { + "name": "itemName", + "type": "TEXT", + "context": "item", + "label": "Item", + "description": "the name of the item", + "required": true + }, + { + "name": "previousState", + "type": "TEXT", + "label": "Previous State", + "description": "the required previous state of the item", + "required": false, + "limitToOptions": false, + "options": [ + { + "label": "ON", + "value": "ON" + }, + { + "label": "OFF", + "value": "OFF" + }, + { + "label": "OPEN", + "value": "OPEN" + }, + { + "label": "CLOSED", + "value": "CLOSED" + }, + { + "label": "UP", + "value": "UP" + }, + { + "label": "DOWN", + "value": "DOWN" + } + ] + }, + { + "name": "state", + "type": "TEXT", + "label": "State", + "description": "the state of the item", + "required": false, + "limitToOptions": false, + "options": [ + { + "label": "ON", + "value": "ON" + }, + { + "label": "OFF", + "value": "OFF" + }, + { + "label": "OPEN", + "value": "OPEN" + }, + { + "label": "CLOSED", + "value": "CLOSED" + }, + { + "label": "UP", + "value": "UP" + }, + { + "label": "DOWN", + "value": "DOWN" + } + ] + } + ], + "outputs": [ + { + "name": "newState", + "type": "state", + "description": "the new item state", + "label": "New State" + }, + { + "name": "oldState", + "type": "state", + "description": "the old item state", + "label": "Old State" + }, + { + "name": "event", + "type": "org.eclipse.smarthome.core.events.Event", + "label": "Event", + "description": "The event which was sent.", + "reference": "event" + } + ] + } + ] } diff --git a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/TimeOfDayTrigger.json b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/TimeOfDayTrigger.json index 221718a2d..ac6e74bde 100644 --- a/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/TimeOfDayTrigger.json +++ b/bundles/org.openhab.core.automation/src/main/resources/ESH-INF/automation/moduletypes/TimeOfDayTrigger.json @@ -1,20 +1,20 @@ -{ - "triggers":[ - { - "uid":"timer.TimeOfDayTrigger", - "label":"it is a fixed time of day", - "description":"Triggers at a specified time", - "visibility":"PUBLIC", - "configDescriptions":[ - { - "name":"time", - "context":"time", - "type":"TEXT", - "label":"Time", - "description":"the time (in hh:mm)", - "required":true - } - ] - } - ] +{ + "triggers": [ + { + "uid": "timer.TimeOfDayTrigger", + "label": "it is a fixed time of day", + "description": "Triggers at a specified time", + "visibility": "PUBLIC", + "configDescriptions": [ + { + "name": "time", + "context": "time", + "type": "TEXT", + "label": "Time", + "description": "the time (in hh:mm)", + "required": true + } + ] + } + ] } diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilderTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilderTest.java index b34e3c97e..f7c7a7f7c 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilderTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilderTest.java @@ -21,6 +21,9 @@ import java.util.Arrays; import org.eclipse.smarthome.config.core.ConfigDescriptionParameter.Type; import org.junit.Test; +/** + * @author Christoph Knauf - Initial contribution + */ public class ConfigDescriptionParameterBuilderTest { @Test diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/ConfigDescriptionRegistryTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/ConfigDescriptionRegistryTest.java index aaba83934..8535bc711 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/ConfigDescriptionRegistryTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/ConfigDescriptionRegistryTest.java @@ -30,14 +30,15 @@ import org.junit.Test; import org.mockito.Mock; /** + * Tests {@link ConfigDescriptionRegistry}. * - * @author Simon Kaufmann - converted to Java + * @author Simon Kaufmann - Initial contribution */ public class ConfigDescriptionRegistryTest extends JavaTest { - private URI URI_DUMMY; - private URI URI_DUMMY1; - private URI URI_ALIASED; + private URI uriDummy; + private URI uriDummy1; + private URI uriAliases; private ConfigDescriptionRegistry configDescriptionRegistry; private ConfigDescription configDescription; private @Mock ConfigDescriptionProvider configDescriptionProviderMock; @@ -55,9 +56,9 @@ public class ConfigDescriptionRegistryTest extends JavaTest { public void setUp() throws Exception { initMocks(this); - URI_DUMMY = new URI("config:Dummy"); - URI_DUMMY1 = new URI("config:Dummy1"); - URI_ALIASED = new URI("config:Aliased"); + uriDummy = new URI("config:Dummy"); + uriDummy1 = new URI("config:Dummy1"); + uriAliases = new URI("config:Aliased"); configDescriptionRegistry = new ConfigDescriptionRegistry(); ConfigDescriptionParameter param1 = new ConfigDescriptionParameter("param1", @@ -65,64 +66,62 @@ public class ConfigDescriptionRegistryTest extends JavaTest { List pList1 = new ArrayList<>(); pList1.add(param1); - configDescription = new ConfigDescription(URI_DUMMY, pList1); + configDescription = new ConfigDescription(uriDummy, pList1); when(configDescriptionProviderMock.getConfigDescriptions(any())) .thenReturn(Collections.singleton(configDescription)); - when(configDescriptionProviderMock.getConfigDescription(eq(URI_DUMMY), any())).thenReturn(configDescription); + when(configDescriptionProviderMock.getConfigDescription(eq(uriDummy), any())).thenReturn(configDescription); - configDescription1 = new ConfigDescription(URI_DUMMY1); + configDescription1 = new ConfigDescription(uriDummy1); when(configDescriptionProviderMock1.getConfigDescriptions(any())) .thenReturn(Collections.singleton(configDescription1)); - when(configDescriptionProviderMock1.getConfigDescription(eq(URI_DUMMY1), any())).thenReturn(configDescription1); + when(configDescriptionProviderMock1.getConfigDescription(eq(uriDummy1), any())).thenReturn(configDescription1); - configDescriptionAliased = new ConfigDescription(URI_ALIASED, Collections + configDescriptionAliased = new ConfigDescription(uriAliases, Collections .singletonList(new ConfigDescriptionParameter("instanceId", ConfigDescriptionParameter.Type.INTEGER))); when(configDescriptionProviderAliased.getConfigDescriptions(any())) .thenReturn(Collections.singleton(configDescriptionAliased)); - when(configDescriptionProviderAliased.getConfigDescription(eq(URI_ALIASED), any())) + when(configDescriptionProviderAliased.getConfigDescription(eq(uriAliases), any())) .thenReturn(configDescriptionAliased); ConfigDescriptionParameter param2 = new ConfigDescriptionParameter("param2", ConfigDescriptionParameter.Type.INTEGER); List pList2 = new ArrayList<>(); pList2.add(param2); - configDescription2 = new ConfigDescription(URI_DUMMY, pList2); + configDescription2 = new ConfigDescription(uriDummy, pList2); when(configDescriptionProviderMock2.getConfigDescriptions(any())) .thenReturn(Collections.singleton(configDescription2)); - when(configDescriptionProviderMock2.getConfigDescription(eq(URI_DUMMY), any())).thenReturn(configDescription2); + when(configDescriptionProviderMock2.getConfigDescription(eq(uriDummy), any())).thenReturn(configDescription2); - when(aliasProvider.getAlias(eq(URI_ALIASED))).thenReturn(URI_DUMMY); + when(aliasProvider.getAlias(eq(uriAliases))).thenReturn(uriDummy); - when(configOptionsProviderMockAliased.getParameterOptions(eq(URI_ALIASED), anyString(), any(), any())) + when(configOptionsProviderMockAliased.getParameterOptions(eq(uriAliases), anyString(), any(), any())) .thenReturn(Collections.singletonList(new ParameterOption("Option", "Aliased"))); - when(configOptionsProviderMockAliased.getParameterOptions(eq(URI_DUMMY), anyString(), any(), any())) + when(configOptionsProviderMockAliased.getParameterOptions(eq(uriDummy), anyString(), any(), any())) .thenReturn(null); - when(configOptionsProviderMock.getParameterOptions(eq(URI_DUMMY), anyString(), any(), any())) + when(configOptionsProviderMock.getParameterOptions(eq(uriDummy), anyString(), any(), any())) .thenReturn(Collections.singletonList(new ParameterOption("Option", "Original"))); - when(configOptionsProviderMock.getParameterOptions(eq(URI_ALIASED), anyString(), any(), any())) - .thenReturn(null); + when(configOptionsProviderMock.getParameterOptions(eq(uriAliases), anyString(), any(), any())).thenReturn(null); } @Test public void testGetConfigDescription() throws Exception { configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock); - ConfigDescription configDescription = configDescriptionRegistry.getConfigDescription(URI_DUMMY); + ConfigDescription configDescription = configDescriptionRegistry.getConfigDescription(uriDummy); assertThat(configDescription, is(notNullValue())); - assertThat(configDescription.getUID(), is(equalTo(URI_DUMMY))); + assertThat(configDescription.getUID(), is(equalTo(uriDummy))); } @Test public void testGetConfigDescriptions() throws Exception { - assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock); assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(1)); List configDescriptions = new ArrayList<>(configDescriptionRegistry.getConfigDescriptions()); - assertThat(configDescriptions.get(0).getUID(), is(equalTo(URI_DUMMY))); + assertThat(configDescriptions.get(0).getUID(), is(equalTo(uriDummy))); assertThat(configDescriptions.get(0).toParametersMap().size(), is(1)); assertThat(configDescriptions.get(0).toParametersMap().get("param1"), notNullValue()); @@ -137,8 +136,7 @@ public class ConfigDescriptionRegistryTest extends JavaTest { } @Test - public void testGetConfigDescriptions_options() throws Exception { - + public void testGetConfigDescriptionsOptions() throws Exception { assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock); @@ -148,7 +146,7 @@ public class ConfigDescriptionRegistryTest extends JavaTest { assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(1)); List configDescriptions = new ArrayList<>(configDescriptionRegistry.getConfigDescriptions()); - assertThat(configDescriptions.get(0).getUID(), is(equalTo(URI_DUMMY))); + assertThat(configDescriptions.get(0).getUID(), is(equalTo(uriDummy))); assertThat(configDescriptions.get(0).getParameters().size(), is(2)); assertThat(configDescriptions.get(0).getParameters().get(0).getName(), is(equalTo("param1"))); @@ -162,25 +160,25 @@ public class ConfigDescriptionRegistryTest extends JavaTest { } @Test - public void testGetConfigDescriptions_aliasedOptions() throws Exception { + public void testGetConfigDescriptionsAliasedOptions() throws Exception { assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock); configDescriptionRegistry.addConfigDescriptionAliasProvider(aliasProvider); configDescriptionRegistry.addConfigOptionProvider(configOptionsProviderMockAliased); - ConfigDescription res = configDescriptionRegistry.getConfigDescription(URI_ALIASED); + ConfigDescription res = configDescriptionRegistry.getConfigDescription(uriAliases); assertThat(res, is(notNullValue())); assertThat(res.getParameters().get(0).getOptions().size(), is(1)); assertThat(res.getParameters().get(0).getOptions().get(0).getLabel(), is("Aliased")); - assertThat(res.getUID(), is(URI_ALIASED)); + assertThat(res.getUID(), is(uriAliases)); configDescriptionRegistry.removeConfigDescriptionProvider(configDescriptionProviderMock); assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); } @Test - public void testGetConfigDescriptions_aliasedOptionsOriginalWins() throws Exception { + public void testGetConfigDescriptionsAliasedOptionsOriginalWins() throws Exception { assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock); @@ -188,48 +186,48 @@ public class ConfigDescriptionRegistryTest extends JavaTest { configDescriptionRegistry.addConfigOptionProvider(configOptionsProviderMock); configDescriptionRegistry.addConfigOptionProvider(configOptionsProviderMockAliased); - ConfigDescription res = configDescriptionRegistry.getConfigDescription(URI_ALIASED); + ConfigDescription res = configDescriptionRegistry.getConfigDescription(uriAliases); assertThat(res, is(notNullValue())); assertThat(res.getParameters().get(0).getOptions().size(), is(1)); assertThat(res.getParameters().get(0).getOptions().get(0).getLabel(), is("Aliased")); - assertThat(res.getUID(), is(URI_ALIASED)); + assertThat(res.getUID(), is(uriAliases)); configDescriptionRegistry.removeConfigDescriptionProvider(configDescriptionProviderMock); assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); } @Test - public void testGetConfigDescriptions_nonAliasOptions() throws Exception { + public void testGetConfigDescriptionsNonAliasOptions() throws Exception { assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock); configDescriptionRegistry.addConfigDescriptionAliasProvider(aliasProvider); configDescriptionRegistry.addConfigOptionProvider(configOptionsProviderMock); - ConfigDescription res = configDescriptionRegistry.getConfigDescription(URI_ALIASED); + ConfigDescription res = configDescriptionRegistry.getConfigDescription(uriAliases); assertThat(res, is(notNullValue())); assertThat(res.getParameters().get(0).getOptions().size(), is(1)); assertThat(res.getParameters().get(0).getOptions().get(0).getLabel(), is("Original")); - assertThat(res.getUID(), is(URI_ALIASED)); + assertThat(res.getUID(), is(uriAliases)); configDescriptionRegistry.removeConfigDescriptionProvider(configDescriptionProviderMock); assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); } @Test - public void testGetConfigDescriptions_aliasedMixes() throws Exception { + public void testGetConfigDescriptionsAliasedMixes() throws Exception { assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0)); configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock); configDescriptionRegistry.addConfigDescriptionAliasProvider(aliasProvider); - ConfigDescription res1 = configDescriptionRegistry.getConfigDescription(URI_ALIASED); + ConfigDescription res1 = configDescriptionRegistry.getConfigDescription(uriAliases); assertThat(res1, is(notNullValue())); assertThat(res1.getParameters().size(), is(1)); configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderAliased); - ConfigDescription res2 = configDescriptionRegistry.getConfigDescription(URI_ALIASED); + ConfigDescription res2 = configDescriptionRegistry.getConfigDescription(uriAliases); assertThat(res2, is(notNullValue())); assertThat(res2.getParameters().size(), is(2)); diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/internal/metadata/MetadataConfigDescriptionProviderImplTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/internal/metadata/MetadataConfigDescriptionProviderImplTest.java index a72c59d2d..b3513e4af 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/internal/metadata/MetadataConfigDescriptionProviderImplTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/internal/metadata/MetadataConfigDescriptionProviderImplTest.java @@ -75,7 +75,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest { } @Test - public void testGetConfigDescriptions_noOptions() { + public void testGetConfigDescriptionsNoOptions() { service.addMetadataConfigDescriptionProvider(mockProviderLiberal); Collection res = service.getConfigDescriptions(Locale.ENGLISH); @@ -93,7 +93,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest { } @Test - public void testGetConfigDescriptions_withOptions() { + public void testGetConfigDescriptionsWithOptions() { service.addMetadataConfigDescriptionProvider(mockProviderRestricted); Collection res = service.getConfigDescriptions(Locale.ENGLISH); @@ -113,7 +113,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest { } @Test - public void testGetConfigDescription_wrongScheme() { + public void testGetConfigDescriptionWrongScheme() { service.addMetadataConfigDescriptionProvider(mockProviderRestricted); service.addMetadataConfigDescriptionProvider(mockProviderLiberal); @@ -121,7 +121,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest { } @Test - public void testGetConfigDescription_valueDescription() { + public void testGetConfigDescriptionValueDescription() { service.addMetadataConfigDescriptionProvider(mockProviderRestricted); service.addMetadataConfigDescriptionProvider(mockProviderLiberal); @@ -137,7 +137,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest { } @Test - public void testGetConfigDescription_valueDescriptionNonExistingNamespace() { + public void testGetConfigDescriptionValueDescriptionNonExistingNamespace() { service.addMetadataConfigDescriptionProvider(mockProviderRestricted); service.addMetadataConfigDescriptionProvider(mockProviderLiberal); @@ -146,7 +146,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest { } @Test - public void testGetConfigDescription_propertiesDescription() { + public void testGetConfigDescriptionPropertiesDescription() { service.addMetadataConfigDescriptionProvider(mockProviderRestricted); service.addMetadataConfigDescriptionProvider(mockProviderLiberal); @@ -163,7 +163,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest { } @Test - public void testGetConfigDescription_propertiesDescriptionNonExistingNamespace() { + public void testGetConfigDescriptionPropertiesDescriptionNonExistingNamespace() { service.addMetadataConfigDescriptionProvider(mockProviderRestricted); service.addMetadataConfigDescriptionProvider(mockProviderLiberal); @@ -172,7 +172,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest { } @Test - public void testGetConfigDescription_propertiesDescriptionNonExistingValue() { + public void testGetConfigDescriptionPropertiesDescriptionNonExistingValue() { service.addMetadataConfigDescriptionProvider(mockProviderRestricted); service.addMetadataConfigDescriptionProvider(mockProviderLiberal); diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/status/ConfigStatusServiceTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/status/ConfigStatusServiceTest.java index 55b03e036..ed5054d9b 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/status/ConfigStatusServiceTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/eclipse/smarthome/config/core/status/ConfigStatusServiceTest.java @@ -64,11 +64,11 @@ public class ConfigStatusServiceTest extends JavaTest { private static final String ARGS = "args"; - private final ConfigStatusMessage PARAM1_MSG1 = ConfigStatusMessage.Builder.information(PARAM1) + private static final ConfigStatusMessage PARAM1_MSG1 = ConfigStatusMessage.Builder.information(PARAM1) .withMessageKeySuffix(MSG_KEY1).build(); - private final ConfigStatusMessage PARAM2_MSG2 = ConfigStatusMessage.Builder.warning(PARAM2) + private static final ConfigStatusMessage PARAM2_MSG2 = ConfigStatusMessage.Builder.warning(PARAM2) .withMessageKeySuffix(MSG_KEY2).withStatusCode(1).withArguments(ARGS).build(); - private final ConfigStatusMessage PARAM3_MSG3 = ConfigStatusMessage.Builder.error(PARAM3) + private static final ConfigStatusMessage PARAM3_MSG3 = ConfigStatusMessage.Builder.error(PARAM3) .withMessageKeySuffix(MSG_KEY3).withStatusCode(2).withArguments(ARGS).build(); private final Collection messagesEntity1 = new ArrayList<>(); diff --git a/bundles/org.openhab.core.config.discovery/src/test/java/org/eclipse/smarthome/config/discovery/inbox/InboxPredicatesTest.java b/bundles/org.openhab.core.config.discovery/src/test/java/org/eclipse/smarthome/config/discovery/inbox/InboxPredicatesTest.java index 80c366321..a7150949f 100644 --- a/bundles/org.openhab.core.config.discovery/src/test/java/org/eclipse/smarthome/config/discovery/inbox/InboxPredicatesTest.java +++ b/bundles/org.openhab.core.config.discovery/src/test/java/org/eclipse/smarthome/config/discovery/inbox/InboxPredicatesTest.java @@ -65,7 +65,7 @@ public class InboxPredicatesTest { .collect(Collectors.toMap(Entry::getKey, Entry::getValue))); private static final Map PROPS2 = Collections.singletonMap(PROP2, PROP_VAL2); - private static final List results = Arrays.asList( + private static final List RESULTS = Arrays.asList( new DiscoveryResultImpl(THING_TYPE_UID11, THING_UID11, null, PROPS1, PROP1, "label", DiscoveryResult.TTL_UNLIMITED), new DiscoveryResultImpl(THING_TYPE_UID11, THING_UID12, null, PROPS1, null, "label", @@ -77,95 +77,95 @@ public class InboxPredicatesTest { @Before public void setUp() throws Exception { - results.get(3).setFlag(DiscoveryResultFlag.IGNORED); + RESULTS.get(3).setFlag(DiscoveryResultFlag.IGNORED); } @Test public void testForBinding() { - assertThat(results.stream().filter(forBinding(BINDING_ID1)).collect(Collectors.toList()).size(), is(3)); + assertThat(RESULTS.stream().filter(forBinding(BINDING_ID1)).collect(Collectors.toList()).size(), is(3)); - assertThat(results.stream().filter(forBinding(BINDING_ID2)).collect(Collectors.toList()).size(), is(1)); - assertThat(results.stream().filter(forBinding(BINDING_ID2)).collect(Collectors.toList()).get(0), - is(equalTo(results.get(3)))); + assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).collect(Collectors.toList()).size(), is(1)); + assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).collect(Collectors.toList()).get(0), + is(equalTo(RESULTS.get(3)))); - assertThat(results.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.NEW)) + assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.NEW)) .collect(Collectors.toList()).size(), is(0)); - assertThat(results.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.IGNORED)) + assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.IGNORED)) .collect(Collectors.toList()).size(), is(1)); - assertThat(results.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.IGNORED)) - .collect(Collectors.toList()).get(0), is(equalTo(results.get(3)))); + assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.IGNORED)) + .collect(Collectors.toList()).get(0), is(equalTo(RESULTS.get(3)))); } @Test public void testForThingTypeUID() { - assertThat(results.stream().filter(forThingTypeUID(THING_TYPE_UID11)).collect(Collectors.toList()).size(), + assertThat(RESULTS.stream().filter(forThingTypeUID(THING_TYPE_UID11)).collect(Collectors.toList()).size(), is(2)); - assertThat(results.stream().filter(forThingTypeUID(THING_TYPE_UID12)).collect(Collectors.toList()).size(), + assertThat(RESULTS.stream().filter(forThingTypeUID(THING_TYPE_UID12)).collect(Collectors.toList()).size(), is(1)); - assertThat(results.stream().filter(forThingTypeUID(THING_TYPE_UID12)).collect(Collectors.toList()).get(0), - is(equalTo(results.get(2)))); + assertThat(RESULTS.stream().filter(forThingTypeUID(THING_TYPE_UID12)).collect(Collectors.toList()).get(0), + is(equalTo(RESULTS.get(2)))); } @Test public void testForThingUID() { - assertThat(results.stream().filter(forThingUID(THING_UID11)).collect(Collectors.toList()).size(), is(1)); - assertThat(results.stream().filter(forThingUID(THING_UID11)).collect(Collectors.toList()).get(0), - is(equalTo(results.get(0)))); + assertThat(RESULTS.stream().filter(forThingUID(THING_UID11)).collect(Collectors.toList()).size(), is(1)); + assertThat(RESULTS.stream().filter(forThingUID(THING_UID11)).collect(Collectors.toList()).get(0), + is(equalTo(RESULTS.get(0)))); - assertThat(results.stream().filter(forThingUID(THING_UID12)).collect(Collectors.toList()).size(), is(2)); - assertThat(results.stream().filter(forThingUID(THING_UID12)).filter(forThingTypeUID(THING_TYPE_UID12)) + assertThat(RESULTS.stream().filter(forThingUID(THING_UID12)).collect(Collectors.toList()).size(), is(2)); + assertThat(RESULTS.stream().filter(forThingUID(THING_UID12)).filter(forThingTypeUID(THING_TYPE_UID12)) .collect(Collectors.toList()).size(), is(1)); - assertThat(results.stream().filter(forThingUID(THING_UID12)).filter(forThingTypeUID(THING_TYPE_UID12)) - .collect(Collectors.toList()).get(0), is(equalTo(results.get(2)))); + assertThat(RESULTS.stream().filter(forThingUID(THING_UID12)).filter(forThingTypeUID(THING_TYPE_UID12)) + .collect(Collectors.toList()).get(0), is(equalTo(RESULTS.get(2)))); } @Test public void testWithFlag() { - assertThat(results.stream().filter(withFlag(DiscoveryResultFlag.NEW)).collect(Collectors.toList()).size(), + assertThat(RESULTS.stream().filter(withFlag(DiscoveryResultFlag.NEW)).collect(Collectors.toList()).size(), is(3)); - assertThat(results.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList()).size(), + assertThat(RESULTS.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList()).size(), is(1)); - assertThat(results.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList()).get(0), - is(equalTo(results.get(3)))); + assertThat(RESULTS.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList()).get(0), + is(equalTo(RESULTS.get(3)))); } @Test public void testWithProperty() { - assertThat(results.stream().filter(withProperty(PROP1, PROP_VAL1)).collect(Collectors.toList()).size(), is(2)); - assertThat(results.stream().filter(withProperty(PROP2, PROP_VAL2)).collect(Collectors.toList()).size(), is(4)); - assertThat(results.stream().filter(withProperty(PROP1, PROP_VAL2)).collect(Collectors.toList()).size(), is(0)); - assertThat(results.stream().filter(withProperty(PROP2, PROP_VAL1)).collect(Collectors.toList()).size(), is(0)); - assertThat(results.stream().filter(withProperty(null, PROP_VAL1)).collect(Collectors.toList()).size(), is(0)); + assertThat(RESULTS.stream().filter(withProperty(PROP1, PROP_VAL1)).collect(Collectors.toList()).size(), is(2)); + assertThat(RESULTS.stream().filter(withProperty(PROP2, PROP_VAL2)).collect(Collectors.toList()).size(), is(4)); + assertThat(RESULTS.stream().filter(withProperty(PROP1, PROP_VAL2)).collect(Collectors.toList()).size(), is(0)); + assertThat(RESULTS.stream().filter(withProperty(PROP2, PROP_VAL1)).collect(Collectors.toList()).size(), is(0)); + assertThat(RESULTS.stream().filter(withProperty(null, PROP_VAL1)).collect(Collectors.toList()).size(), is(0)); } @Test public void testWithRepresentationProperty() { - assertThat(results.stream().filter(withRepresentationProperty(PROP1)).collect(Collectors.toList()).size(), + assertThat(RESULTS.stream().filter(withRepresentationProperty(PROP1)).collect(Collectors.toList()).size(), is(1)); - assertThat(results.stream().filter(withRepresentationProperty(PROP1)).collect(Collectors.toList()).get(0), - is(equalTo(results.get(0)))); - assertThat(results.stream().filter(withRepresentationProperty(PROP2)).collect(Collectors.toList()).size(), + assertThat(RESULTS.stream().filter(withRepresentationProperty(PROP1)).collect(Collectors.toList()).get(0), + is(equalTo(RESULTS.get(0)))); + assertThat(RESULTS.stream().filter(withRepresentationProperty(PROP2)).collect(Collectors.toList()).size(), is(1)); - assertThat(results.stream().filter(withRepresentationProperty(PROP2)).collect(Collectors.toList()).get(0), - is(equalTo(results.get(2)))); + assertThat(RESULTS.stream().filter(withRepresentationProperty(PROP2)).collect(Collectors.toList()).get(0), + is(equalTo(RESULTS.get(2)))); } @Test public void testWithRepresentationPropertyValue() { assertThat( - results.stream().filter(withRepresentationPropertyValue(PROP_VAL1)).collect(Collectors.toList()).size(), + RESULTS.stream().filter(withRepresentationPropertyValue(PROP_VAL1)).collect(Collectors.toList()).size(), is(1)); assertThat( - results.stream().filter(withRepresentationPropertyValue(PROP_VAL1)).collect(Collectors.toList()).get(0), - is(equalTo(results.get(0)))); + RESULTS.stream().filter(withRepresentationPropertyValue(PROP_VAL1)).collect(Collectors.toList()).get(0), + is(equalTo(RESULTS.get(0)))); assertThat( - results.stream().filter(withRepresentationPropertyValue(PROP_VAL2)).collect(Collectors.toList()).size(), + RESULTS.stream().filter(withRepresentationPropertyValue(PROP_VAL2)).collect(Collectors.toList()).size(), is(1)); assertThat( - results.stream().filter(withRepresentationPropertyValue(PROP_VAL2)).collect(Collectors.toList()).get(0), - is(equalTo(results.get(2)))); + RESULTS.stream().filter(withRepresentationPropertyValue(PROP_VAL2)).collect(Collectors.toList()).get(0), + is(equalTo(RESULTS.get(2)))); } } diff --git a/bundles/org.openhab.core.config.discovery/src/test/java/org/eclipse/smarthome/config/discovery/internal/PersistentInboxTest.java b/bundles/org.openhab.core.config.discovery/src/test/java/org/eclipse/smarthome/config/discovery/internal/PersistentInboxTest.java index 4829c054a..50ed2c5ec 100644 --- a/bundles/org.openhab.core.config.discovery/src/test/java/org/eclipse/smarthome/config/discovery/internal/PersistentInboxTest.java +++ b/bundles/org.openhab.core.config.discovery/src/test/java/org/eclipse/smarthome/config/discovery/internal/PersistentInboxTest.java @@ -103,7 +103,7 @@ public class PersistentInboxTest { } @Test - public void testConfigUpdateNormalization_guessType() { + public void testConfigUpdateNormalizationGuessType() { Map props = new HashMap<>(); props.put("foo", 1); Configuration config = new Configuration(props); @@ -121,7 +121,7 @@ public class PersistentInboxTest { } @Test - public void testConfigUpdateNormalization_withConfigDescription() throws Exception { + public void testConfigUpdateNormalizationWithConfigDescription() throws Exception { Map props = new HashMap<>(); props.put("foo", "1"); Configuration config = new Configuration(props); diff --git a/bundles/org.openhab.core.io.rest.core/src/test/java/org/eclipse/smarthome/io/rest/core/internal/channel/ChannelTypeResourceTest.java b/bundles/org.openhab.core.io.rest.core/src/test/java/org/eclipse/smarthome/io/rest/core/internal/channel/ChannelTypeResourceTest.java index 6ab1533ba..a6dc8dc83 100644 --- a/bundles/org.openhab.core.io.rest.core/src/test/java/org/eclipse/smarthome/io/rest/core/internal/channel/ChannelTypeResourceTest.java +++ b/bundles/org.openhab.core.io.rest.core/src/test/java/org/eclipse/smarthome/io/rest/core/internal/channel/ChannelTypeResourceTest.java @@ -62,7 +62,7 @@ public class ChannelTypeResourceTest { } @Test - public void getAll_shouldRetrieveAllChannelTypes() throws Exception { + public void getAllShouldRetrieveAllChannelTypes() throws Exception { channelTypeResource.getAll(null); verify(channelTypeRegistry).getChannelTypes(any(Locale.class)); } diff --git a/bundles/org.openhab.core.io.rest.core/src/test/java/org/eclipse/smarthome/io/rest/core/internal/item/MetadataSelectorMatcherTest.java b/bundles/org.openhab.core.io.rest.core/src/test/java/org/eclipse/smarthome/io/rest/core/internal/item/MetadataSelectorMatcherTest.java index a5ea0e5e6..4f556a5ce 100644 --- a/bundles/org.openhab.core.io.rest.core/src/test/java/org/eclipse/smarthome/io/rest/core/internal/item/MetadataSelectorMatcherTest.java +++ b/bundles/org.openhab.core.io.rest.core/src/test/java/org/eclipse/smarthome/io/rest/core/internal/item/MetadataSelectorMatcherTest.java @@ -73,17 +73,17 @@ public class MetadataSelectorMatcherTest { } @Test - public void nullSelector_shouldReturnEmptySet() { + public void nullSelectorShouldReturnEmptySet() { assertThat(matcher.filterNamespaces(null, null), is(Collections.emptySet())); } @Test - public void emptySelector_shouldReturnEmptySet() { + public void emptySelectorShouldReturnEmptySet() { assertThat(matcher.filterNamespaces("", null), is(Collections.emptySet())); } @Test - public void specificSelector_shouldReturnSpecificNamespace() { + public void specificSelectorShouldReturnSpecificNamespace() { assertThat(matcher.filterNamespaces("alexa", null), hasSize(1)); assertThat(matcher.filterNamespaces("alexa", null), hasItem("alexa")); assertThat(matcher.filterNamespaces("magic", null), hasSize(1)); @@ -95,13 +95,13 @@ public class MetadataSelectorMatcherTest { } @Test - public void regularExpression_shouldMatchSubset() { + public void regularExpressionShouldMatchSubset() { assertThat(matcher.filterNamespaces(".*", null), hasSize(4)); assertThat(matcher.filterNamespaces("magic.?", null), hasSize(2)); } @Test - public void nonConfigDescriptionSelector_shouldBeResult() { + public void nonConfigDescriptionSelectorShouldBeResult() { assertThat(matcher.filterNamespaces("magic, foo, bar", null), hasItems("magic", "foo", "bar")); } } diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/test/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResourceTest.java b/bundles/org.openhab.core.io.rest.sitemap/src/test/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResourceTest.java index 7c26b5bee..b62e7605f 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/test/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResourceTest.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/test/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResourceTest.java @@ -138,7 +138,7 @@ public class SitemapResourceTest extends JavaTest { } @Test - public void whenNoSitemapProvidersAreSet_ShouldReturnEmptyList() { + public void whenNoSitemapProvidersAreSetShouldReturnEmptyList() { sitemapResource.removeSitemapProvider(sitemapProvider); Response sitemaps = sitemapResource.getSitemaps(); @@ -147,7 +147,7 @@ public class SitemapResourceTest extends JavaTest { } @Test - public void whenSitemapsAreProvided_ShouldReturnSitemapBeans() { + public void whenSitemapsAreProvidedShouldReturnSitemapBeans() { Response sitemaps = sitemapResource.getSitemaps(); assertThat((Collection) sitemaps.getEntity(), hasSize(1)); @@ -159,7 +159,7 @@ public class SitemapResourceTest extends JavaTest { } @Test - public void whenLongPolling_ShouldObserveItems() { + public void whenLongPollingShouldObserveItems() { new Thread(() -> { try { Thread.sleep(STATE_UPDATE_WAIT_TIME); // wait for the #getPageData call and listeners to attach to the @@ -180,7 +180,7 @@ public class SitemapResourceTest extends JavaTest { } @Test - public void whenLongPolling_ShouldObserveItemsFromVisibilityRules() { + public void whenLongPollingShouldObserveItemsFromVisibilityRules() { new Thread(() -> { try { Thread.sleep(STATE_UPDATE_WAIT_TIME); // wait for the #getPageData call and listeners to attach to the @@ -201,7 +201,7 @@ public class SitemapResourceTest extends JavaTest { } @Test - public void whenLongPolling_ShouldObserveItemsFromLabelColorConditions() { + public void whenLongPollingShouldObserveItemsFromLabelColorConditions() { new Thread(() -> { try { Thread.sleep(STATE_UPDATE_WAIT_TIME); // wait for the #getPageData call and listeners to attach to the @@ -222,7 +222,7 @@ public class SitemapResourceTest extends JavaTest { } @Test - public void whenLongPolling_ShouldObserveItemsFromValueColorConditions() { + public void whenLongPollingShouldObserveItemsFromValueColorConditions() { new Thread(() -> { try { Thread.sleep(STATE_UPDATE_WAIT_TIME); // wait for the #getPageData call and listeners to attach to the @@ -243,7 +243,7 @@ public class SitemapResourceTest extends JavaTest { } @Test - public void whenGetPageData_ShouldReturnPageBean() throws ItemNotFoundException { + public void whenGetPageDataShouldReturnPageBean() throws ItemNotFoundException { item.setState(new PercentType(50)); configureItemUIRegistry(item.getState(), OnOffType.ON); diff --git a/bundles/org.openhab.core.io.rest/src/test/java/org/eclipse/smarthome/io/rest/JSONResponseTest.java b/bundles/org.openhab.core.io.rest/src/test/java/org/eclipse/smarthome/io/rest/JSONResponseTest.java index c8ff9dbbd..be348f5fe 100644 --- a/bundles/org.openhab.core.io.rest/src/test/java/org/eclipse/smarthome/io/rest/JSONResponseTest.java +++ b/bundles/org.openhab.core.io.rest/src/test/java/org/eclipse/smarthome/io/rest/JSONResponseTest.java @@ -31,6 +31,11 @@ import org.junit.Test; import com.google.gson.JsonObject; +/** + * Tests {@link JSONResponse}. + * + * @author Henning Treu - Initial contribution + */ public class JSONResponseTest { private static final String ENTITY_VALUE = "entityValue"; diff --git a/bundles/org.openhab.core.io.rest/src/test/java/org/eclipse/smarthome/io/rest/Stream2JSONInputStreamTest.java b/bundles/org.openhab.core.io.rest/src/test/java/org/eclipse/smarthome/io/rest/Stream2JSONInputStreamTest.java index 802b1d549..dbb163a22 100644 --- a/bundles/org.openhab.core.io.rest/src/test/java/org/eclipse/smarthome/io/rest/Stream2JSONInputStreamTest.java +++ b/bundles/org.openhab.core.io.rest/src/test/java/org/eclipse/smarthome/io/rest/Stream2JSONInputStreamTest.java @@ -28,11 +28,16 @@ import org.junit.Test; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +/** + * Tests {@link Stream2JSONInputStream}. + * + * @author Henning Treu - Initial contribution + */ public class Stream2JSONInputStreamTest { private Stream2JSONInputStream collection2InputStream; - private final Gson GSON = new GsonBuilder().create(); + private static final Gson GSON = new GsonBuilder().create(); @Test(expected = IllegalArgumentException.class) public void shouldFailForNullSource() throws IOException { diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/eclipse/smarthome/io/transport/mqtt/MqttAsyncClientEx.java b/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/eclipse/smarthome/io/transport/mqtt/MqttAsyncClientEx.java index e8fbb8a67..0e7d964c8 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/eclipse/smarthome/io/transport/mqtt/MqttAsyncClientEx.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/eclipse/smarthome/io/transport/mqtt/MqttAsyncClientEx.java @@ -73,7 +73,6 @@ public class MqttAsyncClientEx extends MqttAsyncClient { @Override public IMqttDeliveryToken publish(String topic, byte[] payload, int qos, boolean retained, Object userContext, IMqttActionListener callback) throws MqttException, MqttPersistenceException { - if (connection.publishSuccess) { callback.onSuccess(getToken(userContext, callback, topic)); } else { diff --git a/bundles/org.openhab.core.io.transport.upnp/src/test/java/org/eclipse/smarthome/io/transport/upnp/internal/UpnpIOServiceTest.java b/bundles/org.openhab.core.io.transport.upnp/src/test/java/org/eclipse/smarthome/io/transport/upnp/internal/UpnpIOServiceTest.java index b176cc95b..6ae87abc4 100644 --- a/bundles/org.openhab.core.io.transport.upnp/src/test/java/org/eclipse/smarthome/io/transport/upnp/internal/UpnpIOServiceTest.java +++ b/bundles/org.openhab.core.io.transport.upnp/src/test/java/org/eclipse/smarthome/io/transport/upnp/internal/UpnpIOServiceTest.java @@ -34,6 +34,11 @@ import org.jupnp.model.types.UDN; import org.jupnp.registry.Registry; import org.mockito.Mock; +/** + * Tests {@link UpnpIOServiceImpl}. + * + * @author Andre Fuechsel - Initial contribution + */ public class UpnpIOServiceTest { private static final String UDN_1_STRING = "UDN"; @@ -90,7 +95,7 @@ public class UpnpIOServiceTest { } @Test - public void testIsRegistered_everythingEmptyInitially() { + public void testIsRegisteredEverythingEmptyInitially() { assertTrue(upnpIoService.isRegistered(upnpIoParticipant)); assertThatEverythingIsEmpty(); } diff --git a/bundles/org.openhab.core.model.lsp/src/test/java/org/eclipse/smarthome/model/lsp/internal/MappingUriExtensionsTest.java b/bundles/org.openhab.core.model.lsp/src/test/java/org/eclipse/smarthome/model/lsp/internal/MappingUriExtensionsTest.java index d30b917af..8efd66592 100644 --- a/bundles/org.openhab.core.model.lsp/src/test/java/org/eclipse/smarthome/model/lsp/internal/MappingUriExtensionsTest.java +++ b/bundles/org.openhab.core.model.lsp/src/test/java/org/eclipse/smarthome/model/lsp/internal/MappingUriExtensionsTest.java @@ -114,7 +114,7 @@ public class MappingUriExtensionsTest { } @Test - public void testToPath_emfURI() { + public void testToPathEmfURI() { MappingUriExtensions mapper = createMapper(); mapper.toUri(request); diff --git a/bundles/org.openhab.core.test/src/test/java/org/eclipse/smarthome/test/java/JavaTestTest.java b/bundles/org.openhab.core.test/src/test/java/org/eclipse/smarthome/test/java/JavaTestTest.java index 6a6a40f76..b28854f8f 100644 --- a/bundles/org.openhab.core.test/src/test/java/org/eclipse/smarthome/test/java/JavaTestTest.java +++ b/bundles/org.openhab.core.test/src/test/java/org/eclipse/smarthome/test/java/JavaTestTest.java @@ -33,14 +33,14 @@ public class JavaTestTest { } @Test - public void waitForAssertShouldRunAfterLastCall_whenAssertionSucceeds() { + public void waitForAssertShouldRunAfterLastCallWhenAssertionSucceeds() { Runnable afterLastCall = mock(Runnable.class); javaTest.waitForAssert(() -> assertTrue(true), null, afterLastCall, 100, 50); verify(afterLastCall, times(1)).run(); } @Test - public void waitForAssertShouldRunAfterLastCall_whenAssertionFails() { + public void waitForAssertShouldRunAfterLastCallWhenAssertionFails() { Runnable afterLastCall = mock(Runnable.class); try { javaTest.waitForAssert(() -> assertTrue(false), null, afterLastCall, 100, 50); diff --git a/bundles/org.openhab.core.thing.xml/src/test/java/org/eclipse/smarthome/core/thing/xml/internal/XmlHelperTest.java b/bundles/org.openhab.core.thing.xml/src/test/java/org/eclipse/smarthome/core/thing/xml/internal/XmlHelperTest.java index 2c69a3f54..128dc55a9 100644 --- a/bundles/org.openhab.core.thing.xml/src/test/java/org/eclipse/smarthome/core/thing/xml/internal/XmlHelperTest.java +++ b/bundles/org.openhab.core.thing.xml/src/test/java/org/eclipse/smarthome/core/thing/xml/internal/XmlHelperTest.java @@ -23,12 +23,12 @@ import org.junit.Test; public class XmlHelperTest { @Test - public void whenUIDContainsDot_shouldBeconvcertedToColon() { + public void whenUIDContainsDotShouldBeconvcertedToColon() { assertThat(XmlHelper.getSystemUID("system.test"), is("system:test")); } @Test - public void whenNoPrefixIsGiven_shouldPrependSystemPrefix() { + public void whenNoPrefixIsGivenShouldPrependSystemPrefix() { assertThat(XmlHelper.getSystemUID("test"), is("system:test")); } } diff --git a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/binding/builder/ThingBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/binding/builder/ThingBuilderTest.java index 0009ffa58..3c52c41e7 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/binding/builder/ThingBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/binding/builder/ThingBuilderTest.java @@ -68,20 +68,20 @@ public class ThingBuilderTest { } @Test(expected = IllegalArgumentException.class) - public void testWithChannel_duplicates() { + public void testWithChannelDuplicates() { thingBuilder.withChannel(ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build()); thingBuilder.withChannel(ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build()); } @Test(expected = IllegalArgumentException.class) - public void testWithChannels_duplicatesCollections() { + public void testWithChannelsDuplicatesCollections() { thingBuilder.withChannels(Arrays.asList( // ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), // ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build())); } @Test(expected = IllegalArgumentException.class) - public void testWithChannels_duplicatesVararg() { + public void testWithChannelsDuplicatesVararg() { thingBuilder.withChannels( // ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), // ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build()); @@ -99,7 +99,7 @@ public class ThingBuilderTest { } @Test - public void testWithoutChannel_missing() { + public void testWithoutChannelMissing() { thingBuilder.withChannels( // ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), // ChannelBuilder.create(new ChannelUID(THING_UID, "channel2"), "").build()); @@ -108,7 +108,7 @@ public class ThingBuilderTest { } @Test(expected = IllegalArgumentException.class) - public void testWithChannel_wrongThing() { + public void testWithChannelWrongThing() { thingBuilder.withChannel( ChannelBuilder.create(new ChannelUID(new ThingUID(THING_TYPE_UID, "wrong"), "channel1"), "").build()); } diff --git a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/firmware/FirmwareEventFactoryTest.java b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/firmware/FirmwareEventFactoryTest.java index 2595bf68b..9c73fc542 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/firmware/FirmwareEventFactoryTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/firmware/FirmwareEventFactoryTest.java @@ -45,11 +45,9 @@ public class FirmwareEventFactoryTest extends JavaTest { @Test public void testSupportedEventTypes() { - Set supportedEventTypes = eventFactory.getSupportedEventTypes(); assertThat(supportedEventTypes, containsInAnyOrder(FirmwareStatusInfoEvent.TYPE, FirmwareUpdateProgressInfoEvent.TYPE, FirmwareUpdateResultInfoEvent.TYPE)); - } @Test(expected = IllegalArgumentException.class) diff --git a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/internal/AutoUpdateManagerTest.java b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/internal/AutoUpdateManagerTest.java index fe8ac9c2a..35d76363b 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/internal/AutoUpdateManagerTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/internal/AutoUpdateManagerTest.java @@ -151,14 +151,14 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_noLink() { + public void testAutoUpdateNoLink() { aum.receiveCommand(event, item); assertStateEvent("AFTER", AutoUpdateManager.EVENT_SOURCE); } @Test - public void testAutoUpdate_noPolicy() { + public void testAutoUpdateNoPolicy() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); aum.receiveCommand(event, item); @@ -167,7 +167,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_noPolicy_thingOFFLINE() { + public void testAutoUpdateNoPolicyThingOFFLINE() { links.add(new ItemChannelLink("test", CHANNEL_UID_OFFLINE_1)); aum.receiveCommand(event, item); @@ -176,7 +176,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_noPolicy_thingOFFLINE_and_thingONLINE() { + public void testAutoUpdateNoPolicyThingOFFLINEandThingONLINE() { links.add(new ItemChannelLink("test", CHANNEL_UID_OFFLINE_1)); links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); @@ -186,7 +186,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_noPolicy_thingONLINE_and_thingOFFLINE() { + public void testAutoUpdateNoPolicyThingONLINEandThingOFFLINE() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); links.add(new ItemChannelLink("test", CHANNEL_UID_OFFLINE_1)); @@ -196,7 +196,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_noPolicy_noHandler() { + public void testAutoUpdateNoPolicyNoHandler() { links.add(new ItemChannelLink("test", CHANNEL_UID_HANDLER_MISSING)); aum.receiveCommand(event, item); @@ -205,7 +205,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_noPolicy_noThing() { + public void testAutoUpdateNoPolicyNoThing() { links.add(new ItemChannelLink("test", new ChannelUID(new ThingUID("test::missing"), "gone"))); aum.receiveCommand(event, item); @@ -214,7 +214,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_noPolicy_noChannel() { + public void testAutoUpdateNoPolicyNoChannel() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE)); aum.receiveCommand(event, item); @@ -223,7 +223,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_policyVETO_thingONLINE() { + public void testAutoUpdatePolicyVETOThingONLINE() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.VETO); @@ -233,7 +233,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_policyRECOMMEND() { + public void testAutoUpdatePolicyRECOMMEND() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.RECOMMEND); @@ -243,7 +243,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_policyVETObeatsDEFAULT() { + public void testAutoUpdatePolicyVETObeatsDEFAULT() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_2)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.VETO); @@ -255,7 +255,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_policyVETObeatsRECOMMEND() { + public void testAutoUpdatePolicyVETObeatsRECOMMEND() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_2)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.VETO); @@ -267,7 +267,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_policyDEFAULTbeatsRECOMMEND() { + public void testAutoUpdatePolicyDEFAULTbeatsRECOMMEND() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_2)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.DEFAULT); @@ -279,7 +279,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_errorInvalidatesVETO() { + public void testAutoUpdateErrorInvalidatesVETO() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.RECOMMEND); @@ -291,7 +291,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_errorInvalidatesVETO2() { + public void testAutoUpdateErrorInvalidatesVETO2() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.DEFAULT); @@ -303,7 +303,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_errorInvalidatesDEFAULT() { + public void testAutoUpdateErrorInvalidatesDEFAULT() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.RECOMMEND); @@ -315,7 +315,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_multipleErrors() { + public void testAutoUpdateMultipleErrors() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE)); links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE)); setAutoUpdatePolicy(CHANNEL_UID_ONLINE_GONE, AutoUpdatePolicy.DEFAULT); @@ -326,7 +326,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_disabled() { + public void testAutoUpdateDisabled() { aum.modified(Collections.singletonMap(AutoUpdateManager.PROPERTY_ENABLED, "false")); aum.receiveCommand(event, item); @@ -335,7 +335,7 @@ public class AutoUpdateManagerTest { } @Test - public void testAutoUpdate_sendOptimisticUpdates() { + public void testAutoUpdateSendOptimisticUpdates() { links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1)); aum.modified(Collections.singletonMap(AutoUpdateManager.PROPERTY_SEND_OPTIMISTIC_UPDATES, "true")); diff --git a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/internal/ChannelItemProviderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/internal/ChannelItemProviderTest.java index 3e464c5f3..4bfe77190 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/internal/ChannelItemProviderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/internal/ChannelItemProviderTest.java @@ -83,13 +83,13 @@ public class ChannelItemProviderTest { } @Test - public void testItemCreation_notThere() throws Exception { + public void testItemCreationNotThere() throws Exception { provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID)); verify(listener, only()).added(same(provider), same(ITEM)); } @Test - public void testItemCreation_alreadyExists() throws Exception { + public void testItemCreationAlreadyExists() throws Exception { when(itemRegistry.get(eq(ITEM_NAME))).thenReturn(ITEM); provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID)); @@ -97,7 +97,7 @@ public class ChannelItemProviderTest { } @Test - public void testItemRemoval_linkRemoved() throws Exception { + public void testItemRemovalLinkRemoved() throws Exception { provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID)); resetAndPrepareListener(); @@ -108,7 +108,7 @@ public class ChannelItemProviderTest { } @Test - public void testItemRemoval_itemFromOtherProvider() throws Exception { + public void testItemRemovalItemFromOtherProvider() throws Exception { provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID)); resetAndPrepareListener(); diff --git a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ChannelGroupTypeBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ChannelGroupTypeBuilderTest.java index 802f00c03..5b3872a71 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ChannelGroupTypeBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ChannelGroupTypeBuilderTest.java @@ -43,12 +43,12 @@ public class ChannelGroupTypeBuilderTest { } @Test(expected = IllegalArgumentException.class) - public void whenLabelIsBlankForState_shouldFail() { + public void whenLabelIsBlankForStateShouldFail() { ChannelGroupTypeBuilder.instance(CHANNEL_GROUP_TYPE_UID, ""); } @Test - public void withLabelAndChannelGroupTypeUID_shouldCreateChannelGroupType() { + public void withLabelAndChannelGroupTypeUIDShouldCreateChannelGroupType() { ChannelGroupType channelGroupType = builder.build(); assertEquals(CHANNEL_GROUP_TYPE_UID, channelGroupType.getUID()); @@ -63,28 +63,28 @@ public class ChannelGroupTypeBuilderTest { } @Test - public void isAdvanced_shouldSetAdvanced() { + public void isAdvancedShouldSetAdvanced() { ChannelGroupType channelGroupType = builder.isAdvanced(true).build(); assertTrue(channelGroupType.isAdvanced()); } @Test - public void withDescription_shouldSetDescription() { + public void withDescriptionShouldSetDescription() { ChannelGroupType channelGroupType = builder.withDescription(DESCRIPTION).build(); assertEquals(DESCRIPTION, channelGroupType.getDescription()); } @Test - public void withCategory_shouldSetCategory() { + public void withCategoryShouldSetCategory() { ChannelGroupType channelGroupType = builder.withCategory(CATEGORY).build(); assertEquals(CATEGORY, channelGroupType.getCategory()); } @Test - public void withChannelDefinitions_shouldSetUnmodifiableChannelDefinitions() { + public void withChannelDefinitionsShouldSetUnmodifiableChannelDefinitions() { ChannelGroupType channelGroupType = builder.withChannelDefinitions(mockList(ChannelDefinition.class, 2)) .build(); diff --git a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ChannelTypeBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ChannelTypeBuilderTest.java index 469e9013a..4b2b918bc 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ChannelTypeBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ChannelTypeBuilderTest.java @@ -42,7 +42,7 @@ public class ChannelTypeBuilderTest { private static final String LABEL = "label"; private static final String TAG = "tag"; private static final List TAGS = Arrays.asList("TAG1", "TAG2"); - private static URI CONFIGDESCRIPTION_URI; + private static URI configDescriptionUri; private static final ChannelTypeUID CHANNEL_TYPE_UID = new ChannelTypeUID("bindingId", "channelId"); private static final StateDescription STATE_DESCRIPTION = new StateDescription(BigDecimal.ZERO, new BigDecimal(100), BigDecimal.ONE, "%s", false, null); @@ -55,29 +55,29 @@ public class ChannelTypeBuilderTest { @Before public void setup() throws URISyntaxException { - CONFIGDESCRIPTION_URI = new URI("config:dummy"); + configDescriptionUri = new URI("config:dummy"); // set up a valid basic ChannelTypeBuilder stateBuilder = ChannelTypeBuilder.state(CHANNEL_TYPE_UID, LABEL, ITEM_TYPE); triggerBuilder = ChannelTypeBuilder.trigger(CHANNEL_TYPE_UID, LABEL); } @Test(expected = IllegalArgumentException.class) - public void whenLabelIsBlankForState_shouldFail() { + public void whenLabelIsBlankForStateShouldFail() { ChannelTypeBuilder.state(CHANNEL_TYPE_UID, "", ITEM_TYPE); } @Test(expected = IllegalArgumentException.class) - public void whenItemTypeIsBlankForState_shouldFail() { + public void whenItemTypeIsBlankForStateShouldFail() { ChannelTypeBuilder.state(CHANNEL_TYPE_UID, LABEL, ""); } @Test(expected = IllegalArgumentException.class) - public void whenLabelIsBlankForTrigger_shouldFail() { + public void whenLabelIsBlankForTriggerShouldFail() { ChannelTypeBuilder.trigger(CHANNEL_TYPE_UID, ""); } @Test - public void withLabelAndChannelTypeUID_shouldCreateChannelType() { + public void withLabelAndChannelTypeUIDShouldCreateChannelType() { ChannelType channelType = stateBuilder.build(); assertThat(channelType.getUID(), is(CHANNEL_TYPE_UID)); @@ -94,56 +94,56 @@ public class ChannelTypeBuilderTest { } @Test - public void isAdvanced_shouldSetAdvanced() { + public void isAdvancedShouldSetAdvanced() { ChannelType channelType = stateBuilder.isAdvanced(true).build(); assertThat(channelType.isAdvanced(), is(true)); } @Test - public void withDescription_shouldSetDescription() { + public void withDescriptionShouldSetDescription() { ChannelType channelType = stateBuilder.withDescription(DESCRIPTION).build(); assertThat(channelType.getDescription(), is(DESCRIPTION)); } @Test - public void withCategory_shouldSetCategory() { + public void withCategoryShouldSetCategory() { ChannelType channelType = stateBuilder.withCategory(CATEGORY).build(); assertThat(channelType.getCategory(), is(CATEGORY)); } @Test - public void withConfigDescriptionURI_shouldSetConfigDescriptionURI() { - ChannelType channelType = stateBuilder.withConfigDescriptionURI(CONFIGDESCRIPTION_URI).build(); + public void withConfigDescriptionURIShouldSetConfigDescriptionURI() { + ChannelType channelType = stateBuilder.withConfigDescriptionURI(configDescriptionUri).build(); - assertThat(channelType.getConfigDescriptionURI(), is(CONFIGDESCRIPTION_URI)); + assertThat(channelType.getConfigDescriptionURI(), is(configDescriptionUri)); } @Test - public void withTags_shouldSetTag() { + public void withTagsShouldSetTag() { ChannelType channelType = stateBuilder.withTag(TAG).build(); assertThat(channelType.getTags(), is(hasSize(1))); } @Test - public void withTags_shouldSetTags() { + public void withTagsShouldSetTags() { ChannelType channelType = stateBuilder.withTags(TAGS).build(); assertThat(channelType.getTags(), is(hasSize(2))); } @Test - public void withStateDescription_shouldSetStateDescription() { + public void withStateDescriptionShouldSetStateDescription() { ChannelType channelType = stateBuilder.withStateDescription(STATE_DESCRIPTION).build(); assertThat(channelType.getState(), is(STATE_DESCRIPTION)); } @Test - public void withEventDescription_shouldSetEventDescription() { + public void withEventDescriptionShouldSetEventDescription() { ChannelType channelType = triggerBuilder.withEventDescription(EVENT_DESCRIPTION).build(); assertThat(channelType.getEvent(), is(EVENT_DESCRIPTION)); diff --git a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ThingTypeBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ThingTypeBuilderTest.java index fa31a5d1b..48ef0ee09 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ThingTypeBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/type/ThingTypeBuilderTest.java @@ -53,27 +53,27 @@ public class ThingTypeBuilderTest { } @Test(expected = IllegalArgumentException.class) - public void whenThingTypeIdAndBindingIdBlank_shouldFail() { + public void whenThingTypeIdAndBindingIdBlankShouldFail() { ThingTypeBuilder.instance("", "", LABEL).build(); } @Test(expected = IllegalArgumentException.class) - public void whenThingTypeIdBlank_shouldFail() { + public void whenThingTypeIdBlankShouldFail() { ThingTypeBuilder.instance(BINDING_ID, "", LABEL).build(); } @Test(expected = IllegalArgumentException.class) - public void whenBindingIdBlank_shouldFail() { + public void whenBindingIdBlankShouldFail() { ThingTypeBuilder.instance("", THING_TYPE_ID, LABEL).build(); } @Test(expected = IllegalArgumentException.class) - public void whenLabelBlank_shouldFail() { + public void whenLabelBlankShouldFail() { ThingTypeBuilder.instance(THING_TYPE_ID, BINDING_ID, "").build(); } @Test - public void withLabelAndThingTypeUID_shouldCreateThingType() { + public void withLabelAndThingTypeUIDShouldCreateThingType() { ThingType thingType = ThingTypeBuilder.instance(new ThingTypeUID(BINDING_ID, THING_TYPE_ID), LABEL).build(); assertThat(thingType.getBindingId(), is(BINDING_ID)); @@ -83,7 +83,7 @@ public class ThingTypeBuilderTest { } @Test - public void withLabelAndThingTypeIdAndBindingID_shouldCreateThingType() { + public void withLabelAndThingTypeIdAndBindingIDShouldCreateThingType() { ThingType thingType = builder.build(); assertThat(thingType.getBindingId(), is(BINDING_ID)); @@ -93,42 +93,42 @@ public class ThingTypeBuilderTest { } @Test - public void withLabelAndThingTypeIdAndBindingID_shouldSetListed() { + public void withLabelAndThingTypeIdAndBindingIDShouldSetListed() { ThingType thingType = builder.build(); assertThat(thingType.isListed(), is(true)); } @Test - public void withDescription_shouldSetDescription() { + public void withDescriptionShouldSetDescription() { ThingType thingType = builder.withDescription(DESCRIPTION).build(); assertThat(thingType.getDescription(), is(DESCRIPTION)); } @Test - public void withCategory_shouldSetCategory() { + public void withCategoryShouldSetCategory() { ThingType thingType = builder.withCategory(CATEGORY).build(); assertThat(thingType.getCategory(), is(CATEGORY)); } @Test - public void withListed_shouldBeListed() { + public void withListedShouldBeListed() { ThingType thingType = builder.isListed(false).build(); assertThat(thingType.isListed(), is(false)); } @Test - public void withRepresentationProperty_shouldSetRepresentationProperty() { + public void withRepresentationPropertyShouldSetRepresentationProperty() { ThingType thingType = builder.withRepresentationProperty(REPRESENTATION_PROPERTY).build(); assertThat(thingType.getRepresentationProperty(), is(REPRESENTATION_PROPERTY)); } @Test - public void withChannelDefinitions_shouldSetUnmodifiableChannelDefinitions() { + public void withChannelDefinitionsShouldSetUnmodifiableChannelDefinitions() { ThingType thingType = builder.withChannelDefinitions(mockList(ChannelDefinition.class, 2)).build(); assertThat(thingType.getChannelDefinitions(), is(hasSize(2))); @@ -141,7 +141,7 @@ public class ThingTypeBuilderTest { } @Test - public void withChannelGroupDefinitions_shouldSetUnmodifiableChannelGroupDefinitions() { + public void withChannelGroupDefinitionsShouldSetUnmodifiableChannelGroupDefinitions() { ThingType thingType = builder.withChannelGroupDefinitions(mockList(ChannelGroupDefinition.class, 2)).build(); assertThat(thingType.getChannelGroupDefinitions(), is(hasSize(2))); @@ -154,7 +154,7 @@ public class ThingTypeBuilderTest { } @Test - public void withProperties_shouldSetUnmodifiableProperties() { + public void withPropertiesShouldSetUnmodifiableProperties() { ThingType thingType = builder.withProperties(mockProperties()).build(); assertThat(thingType.getProperties().entrySet(), is(hasSize(2))); @@ -167,14 +167,14 @@ public class ThingTypeBuilderTest { } @Test - public void withConfigDescriptionURI_shouldSetConfigDescriptionURI() throws Exception { + public void withConfigDescriptionURIShouldSetConfigDescriptionURI() throws Exception { ThingType thingType = builder.withConfigDescriptionURI(new URI(CONF_URI)).build(); assertThat(thingType.getConfigDescriptionURI(), is(new URI(CONF_URI))); } @Test - public void withExtensibleChannelTypeIds_shouldSetUnmodifiableExtensibleChannelTypeIds() { + public void withExtensibleChannelTypeIdsShouldSetUnmodifiableExtensibleChannelTypeIds() { ThingType thingType = builder .withExtensibleChannelTypeIds(Arrays.asList(new String[] { "channelTypeId1", "channelTypeId2" })) .build(); @@ -189,7 +189,7 @@ public class ThingTypeBuilderTest { } @Test - public void withSupportedBridgeTypeUIDs_shouldSetUnmodifiableSupportedBridgeTypeUIDs() { + public void withSupportedBridgeTypeUIDsShouldSetUnmodifiableSupportedBridgeTypeUIDs() { ThingType thingType = builder.withSupportedBridgeTypeUIDs(Arrays.asList(new String[] { "bridgeTypeUID1" })) .build(); diff --git a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/util/ThingHelperTest.java b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/util/ThingHelperTest.java index e4d942a20..59c4be5d8 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/util/ThingHelperTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/eclipse/smarthome/core/thing/util/ThingHelperTest.java @@ -126,18 +126,18 @@ public class ThingHelperTest { @Test(expected = IllegalArgumentException.class) public void assertThatNoDuplicateChannelsCanBeAdded() { - ThingTypeUID THING_TYPE_UID = new ThingTypeUID("test", "test"); - ThingUID THING_UID = new ThingUID(THING_TYPE_UID, "test"); + ThingTypeUID thingTypeUID = new ThingTypeUID("test", "test"); + ThingUID thingUID = new ThingUID(thingTypeUID, "test"); - Thing thing = ThingBuilder.create(THING_TYPE_UID, THING_UID) - .withChannels(ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), - ChannelBuilder.create(new ChannelUID(THING_UID, "channel2"), "").build()) + Thing thing = ThingBuilder.create(thingTypeUID, thingUID) + .withChannels(ChannelBuilder.create(new ChannelUID(thingUID, "channel1"), "").build(), + ChannelBuilder.create(new ChannelUID(thingUID, "channel2"), "").build()) .build(); ThingHelper .addChannelsToThing(thing, - Stream.of(ChannelBuilder.create(new ChannelUID(THING_UID, "channel2"), "").build(), - ChannelBuilder.create(new ChannelUID(THING_UID, "channel3"), "").build()) + Stream.of(ChannelBuilder.create(new ChannelUID(thingUID, "channel2"), "").build(), + ChannelBuilder.create(new ChannelUID(thingUID, "channel3"), "").build()) .collect(toList())); } } diff --git a/bundles/org.openhab.core.ui.icon/src/test/java/org/eclipse/smarthome/ui/icon/AbstractResourceIconProviderTest.java b/bundles/org.openhab.core.ui.icon/src/test/java/org/eclipse/smarthome/ui/icon/AbstractResourceIconProviderTest.java index 1acb05aba..3785fb5ce 100644 --- a/bundles/org.openhab.core.ui.icon/src/test/java/org/eclipse/smarthome/ui/icon/AbstractResourceIconProviderTest.java +++ b/bundles/org.openhab.core.ui.icon/src/test/java/org/eclipse/smarthome/ui/icon/AbstractResourceIconProviderTest.java @@ -40,7 +40,6 @@ public class AbstractResourceIconProviderTest { @Before public void setUp() { - provider = new AbstractResourceIconProvider() { @Override protected InputStream getResource(String iconset, String resourceName) { diff --git a/bundles/org.openhab.core.ui/src/test/java/org/eclipse/smarthome/ui/internal/items/ItemUIRegistryImplTest.java b/bundles/org.openhab.core.ui/src/test/java/org/eclipse/smarthome/ui/internal/items/ItemUIRegistryImplTest.java index f1cbce2fa..056b94a90 100644 --- a/bundles/org.openhab.core.ui/src/test/java/org/eclipse/smarthome/ui/internal/items/ItemUIRegistryImplTest.java +++ b/bundles/org.openhab.core.ui/src/test/java/org/eclipse/smarthome/ui/internal/items/ItemUIRegistryImplTest.java @@ -88,7 +88,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_plainLabel() { + public void getLabelPlainLabel() { String testLabel = "This is a plain text"; when(widget.getLabel()).thenReturn(testLabel); @@ -97,7 +97,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithStaticValue() { + public void getLabelLabelWithStaticValue() { String testLabel = "Label [value]"; when(widget.getLabel()).thenReturn(testLabel); @@ -106,7 +106,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithStringValue() { + public void getLabelLabelWithStringValue() { String testLabel = "Label [%s]"; when(widget.getLabel()).thenReturn(testLabel); @@ -116,7 +116,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithStringValueFunction() { + public void getLabelLabelWithStringValueFunction() { String testLabel = "Label [%s]"; when(widget.getLabel()).thenReturn(testLabel); @@ -126,7 +126,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithIntegerValue() { + public void getLabelLabelWithIntegerValue() { String testLabel = "Label [%d]"; when(widget.getLabel()).thenReturn(testLabel); @@ -137,7 +137,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithIntegerValueAndWidth() { + public void getLabelLabelWithIntegerValueAndWidth() { String testLabel = "Label [%3d]"; when(widget.getLabel()).thenReturn(testLabel); @@ -148,7 +148,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithHexValueAndWidth() { + public void getLabelLabelWithHexValueAndWidth() { String testLabel = "Label [%3x]"; when(widget.getLabel()).thenReturn(testLabel); @@ -159,7 +159,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValue() { + public void getLabelLabelWithDecimalValue() { String testLabel = "Label [%.3f]"; when(widget.getLabel()).thenReturn(testLabel); @@ -170,7 +170,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValueAndUnit() { + public void getLabelLabelWithDecimalValueAndUnit() { String testLabel = "Label [%.3f " + UnitUtils.UNIT_PLACEHOLDER + "]"; when(widget.getLabel()).thenReturn(testLabel); @@ -180,7 +180,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValueAndUnit2() { + public void getLabelLabelWithDecimalValueAndUnit2() { String testLabel = "Label [%.0f " + UnitUtils.UNIT_PLACEHOLDER + "]"; when(widget.getLabel()).thenReturn(testLabel); @@ -190,7 +190,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValueAndUnit3() { + public void getLabelLabelWithDecimalValueAndUnit3() { String testLabel = "Label [%d %%]"; when(widget.getLabel()).thenReturn(testLabel); @@ -200,7 +200,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValueAndUnit4() { + public void getLabelLabelWithDecimalValueAndUnit4() { String testLabel = "Label [%.0f %%]"; when(widget.getLabel()).thenReturn(testLabel); @@ -210,7 +210,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValueAndUnit5() { + public void getLabelLabelWithDecimalValueAndUnit5() { String testLabel = "Label [%d " + UnitUtils.UNIT_PLACEHOLDER + "]"; when(widget.getLabel()).thenReturn(testLabel); @@ -220,7 +220,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValueAndUnit6() { + public void getLabelLabelWithDecimalValueAndUnit6() { String testLabel = "Label [%.0f " + UnitUtils.UNIT_PLACEHOLDER + "]"; when(widget.getLabel()).thenReturn(testLabel); @@ -230,7 +230,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValueAndUnit7() { + public void getLabelLabelWithDecimalValueAndUnit7() { String testLabel = "Label [%d %%]"; when(widget.getLabel()).thenReturn(testLabel); @@ -240,7 +240,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDecimalValueAndUnitConversion() { + public void getLabelLabelWithDecimalValueAndUnitConversion() { String testLabel = "Label [%.2f °F]"; when(widget.getLabel()).thenReturn(testLabel); @@ -250,7 +250,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithPercent() { + public void getLabelLabelWithPercent() { String testLabel = "Label [%.1f %%]"; when(widget.getLabel()).thenReturn(testLabel); @@ -261,7 +261,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithPercentType() { + public void getLabelLabelWithPercentType() { String testLabel = "Label [%d %%]"; when(widget.getLabel()).thenReturn(testLabel); @@ -271,7 +271,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithDate() { + public void getLabelLabelWithDate() { String testLabel = "Label [%1$td.%1$tm.%1$tY]"; when(widget.getLabel()).thenReturn(testLabel); @@ -293,7 +293,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithZonedDate() throws ItemNotFoundException { + public void getLabelLabelWithZonedDate() throws ItemNotFoundException { String testLabel = "Label [%1$td.%1$tm.%1$tY]"; Widget w = mock(Widget.class); @@ -319,7 +319,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithTime() { + public void getLabelLabelWithTime() { String testLabel = "Label [%1$tT]"; when(widget.getLabel()).thenReturn(testLabel); @@ -341,7 +341,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithZonedTime() throws ItemNotFoundException { + public void getLabelLabelWithZonedTime() throws ItemNotFoundException { String testLabel = "Label [%1$tT]"; Widget w = mock(Widget.class); @@ -367,20 +367,20 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_widgetWithoutLabelAndItem() { + public void getLabelWidgetWithoutLabelAndItem() { Widget w = mock(Widget.class); String label = uiRegistry.getLabel(w); assertEquals("", label); } @Test - public void getLabel_widgetWithoutLabel() { + public void getLabelWidgetWithoutLabel() { String label = uiRegistry.getLabel(widget); assertEquals("Item", label); } @Test - public void getLabel_labelFromUIProvider() { + public void getLabelLabelFromUIProvider() { ItemUIProvider provider = mock(ItemUIProvider.class); uiRegistry.addItemUIProvider(provider); when(provider.getLabel(anyString())).thenReturn("ProviderLabel"); @@ -390,7 +390,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelForUndefinedStringItemState() { + public void getLabelLabelForUndefinedStringItemState() { String testLabel = "Label [%s]"; when(widget.getLabel()).thenReturn(testLabel); @@ -400,7 +400,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelForUndefinedIntegerItemState() { + public void getLabelLabelForUndefinedIntegerItemState() { String testLabel = "Label [%d]"; when(widget.getLabel()).thenReturn(testLabel); @@ -410,7 +410,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelForUndefinedDecimalItemState() { + public void getLabelLabelForUndefinedDecimalItemState() { String testLabel = "Label [%.2f]"; when(widget.getLabel()).thenReturn(testLabel); @@ -420,7 +420,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelForUndefinedDateItemState() { + public void getLabelLabelForUndefinedDateItemState() { String testLabel = "Label [%1$td.%1$tm.%1$tY]"; when(widget.getLabel()).thenReturn(testLabel); @@ -430,7 +430,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelForUndefinedQuantityItemState() { + public void getLabelLabelForUndefinedQuantityItemState() { String testLabel = "Label [%.2f " + UnitUtils.UNIT_PLACEHOLDER + "]"; when(widget.getLabel()).thenReturn(testLabel); @@ -440,7 +440,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_itemNotFound() throws ItemNotFoundException { + public void getLabelItemNotFound() throws ItemNotFoundException { String testLabel = "Label [%s]"; when(widget.getLabel()).thenReturn(testLabel); @@ -452,7 +452,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithFunctionValue() { + public void getLabelLabelWithFunctionValue() { String testLabel = "Label [MAP(de.map):%s]"; when(widget.getLabel()).thenReturn(testLabel); @@ -462,7 +462,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_groupLabelWithValue() { + public void getLabelGroupLabelWithValue() { String testLabel = "Label [%d]"; when(widget.getLabel()).thenReturn(testLabel); @@ -473,7 +473,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getWidget_UnknownPageId() throws ItemNotFoundException { + public void getWidgetUnknownPageId() throws ItemNotFoundException { Sitemap sitemap = SitemapFactory.eINSTANCE.createSitemap(); when(registry.getItem("unknown")).thenThrow(new ItemNotFoundException("unknown")); Widget w = uiRegistry.getWidget(sitemap, "unknown"); @@ -554,7 +554,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithoutStateDescription() { + public void getLabelLabelWithoutStateDescription() { String testLabel = "Label"; when(widget.getLabel()).thenReturn(testLabel); @@ -565,7 +565,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithoutPatternInStateDescription() { + public void getLabelLabelWithoutPatternInStateDescription() { String testLabel = "Label"; StateDescription stateDescription = mock(StateDescription.class); @@ -578,7 +578,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithPatternInStateDescription() { + public void getLabelLabelWithPatternInStateDescription() { String testLabel = "Label"; StateDescription stateDescription = mock(StateDescription.class); @@ -591,7 +591,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithEmptyPattern() { + public void getLabelLabelWithEmptyPattern() { String testLabel = "Label []"; StateDescription stateDescription = mock(StateDescription.class); @@ -604,7 +604,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithMappedOption() { + public void getLabelLabelWithMappedOption() { String testLabel = "Label"; StateDescription stateDescription = mock(StateDescription.class); @@ -621,7 +621,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_labelWithUnmappedOption() { + public void getLabelLabelWithUnmappedOption() { String testLabel = "Label"; StateDescription stateDescription = mock(StateDescription.class); @@ -638,7 +638,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabel_transformationContainingPercentS() throws ItemNotFoundException { + public void getLabelTransformationContainingPercentS() throws ItemNotFoundException { // It doesn't matter that "FOO" doesn't exist - this is to assert it doesn't fail before because of the two "%s" String testLabel = "Memory [FOO(echo %s):%s]"; Widget w = mock(Widget.class); @@ -652,7 +652,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabelColor_labelWithDecimalValue() { + public void getLabelColorLabelWithDecimalValue() { String testLabel = "Label [%.3f]"; when(widget.getLabel()).thenReturn(testLabel); @@ -672,7 +672,7 @@ public class ItemUIRegistryImplTest { } @Test - public void getLabelColor_labelWithUnitValue() { + public void getLabelColorLabelWithUnitValue() { String testLabel = "Label [%.3f " + UnitUtils.UNIT_PLACEHOLDER + "]"; when(widget.getLabel()).thenReturn(testLabel); diff --git a/bundles/org.openhab.core.ui/src/test/java/org/eclipse/smarthome/ui/internal/proxy/ProxyServletServiceTest.java b/bundles/org.openhab.core.ui/src/test/java/org/eclipse/smarthome/ui/internal/proxy/ProxyServletServiceTest.java index 4ad0dccc0..43b1064ca 100644 --- a/bundles/org.openhab.core.ui/src/test/java/org/eclipse/smarthome/ui/internal/proxy/ProxyServletServiceTest.java +++ b/bundles/org.openhab.core.ui/src/test/java/org/eclipse/smarthome/ui/internal/proxy/ProxyServletServiceTest.java @@ -63,7 +63,7 @@ public class ProxyServletServiceTest { private static final String VALID_IMAGE_URL = "https://www.eclipse.org/smarthome/test.jpg"; private static final String VALID_VIDEO_URL = "https://www.eclipse.org/smarthome/test.mp4"; - static private ProxyServletService service; + private static ProxyServletService service; private ItemUIRegistry itemUIRegistry; private ModelRepository modelRepository; diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/QueueingThreadPoolExecutorTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/QueueingThreadPoolExecutorTest.java index a100aa1f6..668196e07 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/QueueingThreadPoolExecutorTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/QueueingThreadPoolExecutorTest.java @@ -272,7 +272,7 @@ public class QueueingThreadPoolExecutorTest { return new Runnable10s(); } - private static abstract class AbstractRunnable implements Runnable { + private abstract static class AbstractRunnable implements Runnable { private static AtomicInteger runs = new AtomicInteger(0); protected final Logger logger = LoggerFactory.getLogger(AbstractRunnable.class); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/ThreadFactoryBuilderTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/ThreadFactoryBuilderTest.java index 774a2e681..ac10b8611 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/ThreadFactoryBuilderTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/ThreadFactoryBuilderTest.java @@ -99,7 +99,6 @@ public class ThreadFactoryBuilderTest { UncaughtExceptionHandler handler = new UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { - } }; diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/osgi/ResourceBundleClassLoaderTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/osgi/ResourceBundleClassLoaderTest.java index 37d578e21..27e72f6f2 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/osgi/ResourceBundleClassLoaderTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/common/osgi/ResourceBundleClassLoaderTest.java @@ -34,14 +34,14 @@ import org.osgi.framework.Bundle; public class ResourceBundleClassLoaderTest { static URL createTmpTestPropetiesFile(Path root, String relativeFile) throws Exception { - Path file = Paths.get(relativeFile); - Path fileDir = file.getParent(); + Path filePath = Paths.get(relativeFile); + Path dirPath = filePath.getParent(); - new File(root.toFile(), fileDir.toString()).mkdirs(); - File _file = new File(root.toFile(), relativeFile); - _file.createNewFile(); + new File(root.toFile(), dirPath.toString()).mkdirs(); + File file = new File(root.toFile(), relativeFile); + file.createNewFile(); - return _file.toURL(); + return file.toURL(); } @Test diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/i18n/I18nProviderImplTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/i18n/I18nProviderImplTest.java index e62fabc6c..004611875 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/i18n/I18nProviderImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/i18n/I18nProviderImplTest.java @@ -70,7 +70,6 @@ public class I18nProviderImplTest { @Before public void setup() { - initMocks(this); initialConfig = buildInitialConfig(); when(componentContext.getProperties()).thenReturn(initialConfig); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/items/MetadataRegistryImplTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/items/MetadataRegistryImplTest.java index f50a8f77c..98ca6d041 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/items/MetadataRegistryImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/items/MetadataRegistryImplTest.java @@ -70,7 +70,7 @@ public class MetadataRegistryImplTest { } @Test - public void testGet_empty() throws Exception { + public void testGetEmpty() throws Exception { MetadataKey key = new MetadataKey("namespace", "itemName"); Metadata res = registry.get(key); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/service/StateDescriptionServiceImplTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/service/StateDescriptionServiceImplTest.java index 00a56bc20..9bd7064af 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/service/StateDescriptionServiceImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/internal/service/StateDescriptionServiceImplTest.java @@ -21,8 +21,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.smarthome.core.internal.service.StateDescriptionServiceImpl; import org.eclipse.smarthome.core.library.items.NumberItem; import org.eclipse.smarthome.core.types.StateDescription; import org.eclipse.smarthome.core.types.StateDescriptionFragment; @@ -36,7 +34,7 @@ import org.junit.Test; /** * Tests for the StateDescriptionService implementation * - * @author Lyubomir Papazov + * @author Lyubomir Papazov - Initial contribution */ @SuppressWarnings({ "deprecation", "null" }) public class StateDescriptionServiceImplTest { @@ -62,7 +60,7 @@ public class StateDescriptionServiceImplTest { } @Test - public void legacy_testServiceWithOneStateDescriptionProvider() { + public void legacyTestServiceWithOneStateDescriptionProvider() { StateDescriptionProvider stateDescriptionProviderDefault = mock(StateDescriptionProvider.class); when(stateDescriptionProviderDefault.getRank()).thenReturn(STATE_DESCRIPTION_PROVIDER_DEFAULT_SERVICE_RANKING); StateDescription stateDescription = new StateDescription(STATE_DESCRIPTION_PROVIDER_DEFAULT_MIN_VALUE, @@ -83,7 +81,7 @@ public class StateDescriptionServiceImplTest { } @Test - public void legacy_testMinValueMaxValueStepAndPatternTwoDescriptionProviders() { + public void legacyTestMinValueMaxValueStepAndPatternTwoDescriptionProviders() { StateDescription stateDescription1 = new StateDescription(new BigDecimal("-1"), new BigDecimal("-1"), new BigDecimal("-1"), "pattern1", false, null); StateDescription stateDescription2 = new StateDescription(new BigDecimal("-2"), new BigDecimal("-2"), @@ -100,7 +98,7 @@ public class StateDescriptionServiceImplTest { } @Test - public void legacy_testIsReadOnlyWhenTwoDescriptionProvidersHigherRankingIsNotReadOnly() { + public void legacyTestIsReadOnlyWhenTwoDescriptionProvidersHigherRankingIsNotReadOnly() { StateDescription stateDescription1 = new StateDescription(null, null, null, null, false, null); StateDescription stateDescription2 = new StateDescription(null, null, null, null, true, null); @@ -112,7 +110,7 @@ public class StateDescriptionServiceImplTest { } @Test - public void legacy_testIsReadOnlyWhenTwoDescriptionProvidersHigherRankingIsReadOnly() { + public void legacyTestIsReadOnlyWhenTwoDescriptionProvidersHigherRankingIsReadOnly() { StateDescription stateDescription1 = new StateDescription(null, null, null, null, true, null); StateDescription stateDescription2 = new StateDescription(null, null, null, null, false, null); @@ -124,7 +122,7 @@ public class StateDescriptionServiceImplTest { } @Test - public void legacy_testOptionsWhenTwoDescriptionProvidersHigherRankingProvidesOptions() { + public void legacyTestOptionsWhenTwoDescriptionProvidersHigherRankingProvidesOptions() { StateDescription stateDescription1 = new StateDescription(null, null, null, null, false, Arrays.asList(new StateOption("value", "label"))); StateDescription stateDescription2 = new StateDescription(null, null, null, null, false, @@ -138,7 +136,7 @@ public class StateDescriptionServiceImplTest { } @Test - public void legacy_testOptionsWhenTwoDescriptionProvidersHigherRankingDoesntProvideOptions() { + public void legacyTestOptionsWhenTwoDescriptionProvidersHigherRankingDoesntProvideOptions() { StateDescription stateDescription1 = new StateDescription(null, null, null, null, false, Collections.emptyList()); StateDescription stateDescription2 = new StateDescription(null, null, null, null, false, @@ -156,7 +154,7 @@ public class StateDescriptionServiceImplTest { StateDescription stateDescription = new StateDescription(null, null, null, "pattern", false, null); registerStateDescriptionProvider(stateDescription, 1); - List<@NonNull StateOption> options = Arrays.asList(new StateOption("value", "label")); + List options = Arrays.asList(new StateOption("value", "label")); StateDescriptionFragment stateDescriptionFragment = StateDescriptionFragmentBuilder.create() .withMinimum(BigDecimal.ZERO).withMaximum(BigDecimal.TEN).withOptions(options).build(); registerStateDescriptionFragmentProvider(stateDescriptionFragment, 1); @@ -172,18 +170,16 @@ public class StateDescriptionServiceImplTest { @Test public void testFragmentProviderOrder() { - List<@NonNull StateOption> options = Arrays.asList(new StateOption("value", "label")); + List options = Arrays.asList(new StateOption("value", "label")); - StateDescriptionFragment firstFragment = StateDescriptionFragmentBuilder.create() - .withMinimum(BigDecimal.ZERO) // + StateDescriptionFragment firstFragment = StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.ZERO) // .withMaximum(BigDecimal.TEN) // .withPattern("pattern") // .withReadOnly(Boolean.TRUE) // .withOptions(options).build(); registerStateDescriptionFragmentProvider(firstFragment, -1); - StateDescriptionFragment secondFragment = StateDescriptionFragmentBuilder.create() - .withMinimum(BigDecimal.ONE) // + StateDescriptionFragment secondFragment = StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.ONE) // .withMaximum(BigDecimal.ONE) // .withStep(BigDecimal.ONE) // .withPattern("base_pattern") // diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/GenericItemTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/GenericItemTest.java index 002f2f028..8c660793a 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/GenericItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/GenericItemTest.java @@ -79,19 +79,19 @@ public class GenericItemTest { @Test(expected = IllegalArgumentException.class) public void testAddGroupNameWithNull() { TestItem item = new TestItem("member1"); - item.addGroupName(NULL()); + item.addGroupName(toNull()); } @Test(expected = IllegalArgumentException.class) public void testAddGroupNamesWithNull() { TestItem item = new TestItem("member1"); - item.addGroupNames(Arrays.asList("group-a", NULL(), "group-b")); + item.addGroupNames(Arrays.asList("group-a", toNull(), "group-b")); } @Test(expected = IllegalArgumentException.class) public void testRemoveGroupNameWithNull() { TestItem item = new TestItem("member1"); - item.removeGroupName(NULL()); + item.removeGroupName(toNull()); } @Test @@ -119,7 +119,7 @@ public class GenericItemTest { public void testGetStateAsWithNull() { TestItem item = new TestItem("member1"); item.setState(StringType.valueOf("Hello World")); - assertNull(item.getStateAs(NULL())); + assertNull(item.getStateAs(toNull())); } @Test @@ -197,7 +197,7 @@ public class GenericItemTest { * * @return always {@code null} */ - private T NULL() { + private T toNull() { return null; // :-P } diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/dto/ItemDTOMapperTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/dto/ItemDTOMapperTest.java index 57b770d79..6a85f977a 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/dto/ItemDTOMapperTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/dto/ItemDTOMapperTest.java @@ -31,7 +31,6 @@ public class ItemDTOMapperTest { @Test public void testMapFunctionWithNumberItemAndCountFunction() { - // testing Group:Number:Count(".*hello.*") NumberItem item1 = new NumberItem("item1"); @@ -44,7 +43,6 @@ public class ItemDTOMapperTest { assertThat(gFunc, instanceOf(ArithmeticGroupFunction.Count.class)); assertThat(gFunc.getParameters().length, is(1)); assertThat(gFunc.getParameters()[0], instanceOf(StringType.class)); - } } diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/events/ItemEventFactoryTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/events/ItemEventFactoryTest.java index 0030e8b32..39fc7cf43 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/events/ItemEventFactoryTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/items/events/ItemEventFactoryTest.java @@ -72,7 +72,7 @@ public class ItemEventFactoryTest { RawType.DEFAULT_MIME_TYPE); @Test - public void testCreateEvent_ItemCommandEvent_OnOffType() throws Exception { + public void testCreateEventItemCommandEventOnOffType() throws Exception { Event event = factory.createEvent(ITEM_COMMAND_EVENT_TYPE, ITEM_COMMAND_EVENT_TOPIC, ITEM_COMMAND_EVENT_PAYLOAD, SOURCE); @@ -88,7 +88,7 @@ public class ItemEventFactoryTest { } @Test - public void testCreateCommandEvent_OnOffType() throws Exception { + public void testCreateCommandEventOnOffType() throws Exception { ItemCommandEvent event = ItemEventFactory.createCommandEvent(ITEM_NAME, ITEM_COMMAND, SOURCE); assertEquals(ITEM_COMMAND_EVENT_TYPE, event.getType()); @@ -101,7 +101,7 @@ public class ItemEventFactoryTest { } @Test - public void testCreateEvent_ItemCommandEvent_RefreshType() throws Exception { + public void testCreateEventItemCommandEventRefreshType() throws Exception { Event event = factory.createEvent(ITEM_COMMAND_EVENT_TYPE, ITEM_COMMAND_EVENT_TOPIC, ITEM_REFRESH_COMMAND_EVENT_PAYLOAD, SOURCE); @@ -116,7 +116,7 @@ public class ItemEventFactoryTest { } @Test - public void testCreateEvent_ItemStateEvent_UnDefType() throws Exception { + public void testCreateEventItemStateEventUnDefType() throws Exception { Event event = factory.createEvent(ITEM_STATE_EVENT_TYPE, ITEM_STATE_EVENT_TOPIC, ITEM_UNDEF_STATE_EVENT_PAYLOAD, SOURCE); @@ -132,7 +132,7 @@ public class ItemEventFactoryTest { } @Test - public void testCreateEvent_GroupItemStateChangedEvent() throws Exception { + public void testCreateEventGroupItemStateChangedEvent() throws Exception { Event event = factory.createEvent(GROUPITEM_CHANGED_EVENT_TYPE, GROUPITEM_STATE_CHANGED_EVENT_TOPIC, ITEM_STATE_CHANGED_EVENT_PAYLOAD, SOURCE); @@ -150,7 +150,7 @@ public class ItemEventFactoryTest { } @Test - public void testCreateEvent_ItemStateEvent_OnOffType() throws Exception { + public void testCreateEventItemStateEventOnOffType() throws Exception { Event event = factory.createEvent(ITEM_STATE_EVENT_TYPE, ITEM_STATE_EVENT_TOPIC, ITEM_STATE_EVENT_PAYLOAD, SOURCE); @@ -166,7 +166,7 @@ public class ItemEventFactoryTest { } @Test - public void testCreateEvent_ItemStatePredictedEvent_OnOffType() throws Exception { + public void testCreateEventItemStatePredictedEventOnOffType() throws Exception { Event event = factory.createEvent(ITEM_STATE_PREDICTED_EVENT_TYPE, ITEM_STATE_PREDICTED_EVENT_TOPIC, ITEM_STATE_PREDICTED_EVENT_PAYLOAD, SOURCE); @@ -181,7 +181,7 @@ public class ItemEventFactoryTest { } @Test - public void testCreateStateEvent_OnOffType() { + public void testCreateStateEventOnOffType() { ItemStateEvent event = ItemEventFactory.createStateEvent(ITEM_NAME, ITEM_STATE, SOURCE); assertThat(event.getType(), is(ITEM_STATE_EVENT_TYPE)); @@ -194,7 +194,7 @@ public class ItemEventFactoryTest { } @Test - public void testCreateEvent_ItemAddedEvent() throws Exception { + public void testCreateEventItemAddedEvent() throws Exception { Event event = factory.createEvent(ITEM_ADDED_EVENT_TYPE, ITEM_ADDED_EVENT_TOPIC, ITEM_ADDED_EVENT_PAYLOAD, null); @@ -220,19 +220,19 @@ public class ItemEventFactoryTest { } @Test - public void testCreateGroupStateChangedEvent_RawType() throws Exception { - GroupItemStateChangedEvent giEvent_source = ItemEventFactory.createGroupStateChangedEvent(GROUP_NAME, ITEM_NAME, + public void testCreateGroupStateChangedEventRawType() throws Exception { + GroupItemStateChangedEvent giEventSource = ItemEventFactory.createGroupStateChangedEvent(GROUP_NAME, ITEM_NAME, NEW_RAW_ITEM_STATE, RAW_ITEM_STATE); - Event giEvent_parsed = factory.createEvent(giEvent_source.getType(), giEvent_source.getTopic(), - giEvent_source.getPayload(), giEvent_source.getSource()); + Event giEventParsed = factory.createEvent(giEventSource.getType(), giEventSource.getTopic(), + giEventSource.getPayload(), giEventSource.getSource()); - assertEquals(GroupItemStateChangedEvent.class, giEvent_parsed.getClass()); - GroupItemStateChangedEvent groupItemStateChangedEvent = (GroupItemStateChangedEvent) giEvent_parsed; + assertEquals(GroupItemStateChangedEvent.class, giEventParsed.getClass()); + GroupItemStateChangedEvent groupItemStateChangedEvent = (GroupItemStateChangedEvent) giEventParsed; assertEquals(GROUPITEM_CHANGED_EVENT_TYPE, groupItemStateChangedEvent.getType()); assertEquals(GROUPITEM_STATE_CHANGED_EVENT_TOPIC, groupItemStateChangedEvent.getTopic()); - assertEquals(giEvent_source.getPayload(), groupItemStateChangedEvent.getPayload()); + assertEquals(giEventSource.getPayload(), groupItemStateChangedEvent.getPayload()); assertEquals(GROUP_NAME, groupItemStateChangedEvent.getItemName()); assertEquals(ITEM_NAME, groupItemStateChangedEvent.getMemberName()); assertNull(groupItemStateChangedEvent.getSource()); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/items/CallItemTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/items/CallItemTest.java index f3582340f..0f6a45b4c 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/items/CallItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/items/CallItemTest.java @@ -26,7 +26,6 @@ public class CallItemTest { @Test public void testSetStringListType() { - StringListType callType1 = new StringListType("0699222222", "0179999998"); CallItem callItem1 = new CallItem("testItem"); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/items/RollershutterItemTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/items/RollershutterItemTest.java index 0af91eda5..a083747ca 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/items/RollershutterItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/items/RollershutterItemTest.java @@ -28,7 +28,7 @@ import org.junit.Test; public class RollershutterItemTest { @Test - public void setState_stateDown_returnPercent100() { + public void setStateStateDownReturnPercent100() { RollershutterItem sut = new RollershutterItem("Test"); State state = UpDownType.DOWN; sut.setState(state); @@ -36,7 +36,7 @@ public class RollershutterItemTest { } @Test - public void setState_stateUp_returnPercent0() { + public void setStateStateUpReturnPercent0() { RollershutterItem sut = new RollershutterItem("Test"); State state = UpDownType.UP; sut.setState(state); @@ -44,7 +44,7 @@ public class RollershutterItemTest { } @Test - public void setState_statePercent50_returnPercent50() { + public void setStateStatePercent50ReturnPercent50() { RollershutterItem sut = new RollershutterItem("Test"); State state = new PercentType(50); sut.setState(state); @@ -52,7 +52,7 @@ public class RollershutterItemTest { } @Test - public void setState_stateHSB50_returnPercent50() { + public void setStateStateHSB50ReturnPercent50() { // HSB supported because it is a sub-type of PercentType RollershutterItem sut = new RollershutterItem("Test"); State state = new HSBType("5,23,42"); @@ -61,7 +61,7 @@ public class RollershutterItemTest { } @Test - public void setState_stateUndef() { + public void setStateStateUndef() { RollershutterItem sut = new RollershutterItem("Test"); StateUtil.testUndefStates(sut); } diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/ArithmeticGroupFunctionTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/ArithmeticGroupFunctionTest.java index 2b47eec79..a5c871f7f 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/ArithmeticGroupFunctionTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/ArithmeticGroupFunctionTest.java @@ -58,7 +58,7 @@ public class ArithmeticGroupFunctionTest { } @Test - public void testOrFunction_negative() { + public void testOrFunctionNegative() { items.add(new TestItem("TestItem1", OpenClosedType.CLOSED)); items.add(new TestItem("TestItem2", UnDefType.UNDEF)); items.add(new TestItem("TestItem3", OpenClosedType.CLOSED)); @@ -72,7 +72,7 @@ public class ArithmeticGroupFunctionTest { } @Test - public void testOrFunction_justsOneItem() { + public void testOrFunctionJustsOneItem() { items.add(new TestItem("TestItem1", UnDefType.UNDEF)); function = new ArithmeticGroupFunction.Or(OpenClosedType.OPEN, OpenClosedType.CLOSED); @@ -82,7 +82,7 @@ public class ArithmeticGroupFunctionTest { } @Test - public void testOrFunction_differntTypes() { + public void testOrFunctionDifferentTypes() { DimmerItem dimmer1 = new DimmerItem("TestDimmer1"); dimmer1.setState(new PercentType("42")); DimmerItem dimmer2 = new DimmerItem("TestDimmer2"); @@ -120,7 +120,7 @@ public class ArithmeticGroupFunctionTest { } @Test - public void testNOrFunction_negative() { + public void testNOrFunctionNegative() { items.add(new TestItem("TestItem1", OpenClosedType.CLOSED)); items.add(new TestItem("TestItem2", UnDefType.UNDEF)); items.add(new TestItem("TestItem3", OpenClosedType.CLOSED)); @@ -146,7 +146,7 @@ public class ArithmeticGroupFunctionTest { } @Test - public void testAndFunction_negative() { + public void testAndFunctionNegative() { items.add(new TestItem("TestItem1", OpenClosedType.OPEN)); items.add(new TestItem("TestItem2", UnDefType.UNDEF)); items.add(new TestItem("TestItem3", OpenClosedType.OPEN)); @@ -160,7 +160,7 @@ public class ArithmeticGroupFunctionTest { } @Test - public void testAndFunction_justsOneItem() { + public void testAndFunctionJustsOneItem() { items.add(new TestItem("TestItem1", UnDefType.UNDEF)); function = new ArithmeticGroupFunction.And(OpenClosedType.OPEN, OpenClosedType.CLOSED); @@ -182,7 +182,7 @@ public class ArithmeticGroupFunctionTest { } @Test - public void testNAndFunction_negative() { + public void testNAndFunctionNegative() { items.add(new TestItem("TestItem1", OpenClosedType.OPEN)); items.add(new TestItem("TestItem2", OpenClosedType.OPEN)); items.add(new TestItem("TestItem3", OpenClosedType.CLOSED)); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/DateTimeGroupFunctionTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/DateTimeGroupFunctionTest.java index 65ff848eb..d6812523a 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/DateTimeGroupFunctionTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/DateTimeGroupFunctionTest.java @@ -30,7 +30,7 @@ import org.junit.Before; import org.junit.Test; /** - * @author Robert Michalak + * @author Robert Michalak - Initial contribution */ public class DateTimeGroupFunctionTest { @@ -44,7 +44,6 @@ public class DateTimeGroupFunctionTest { @Test public void testLatestFunction() { - ZonedDateTime expectedDateTime = ZonedDateTime.now(); items.add(new TestItem("TestItem1", new DateTimeType(expectedDateTime))); items.add(new TestItem("TestItem2", UnDefType.UNDEF)); @@ -61,7 +60,6 @@ public class DateTimeGroupFunctionTest { @Test public void testEarliestFunction() { - ZonedDateTime expectedDateTime = ZonedDateTime.now(); items.add(new TestItem("TestItem1", new DateTimeType(expectedDateTime))); items.add(new TestItem("TestItem2", UnDefType.UNDEF)); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/DateTimeTypeTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/DateTimeTypeTest.java index c899b05b0..422f971ff 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/DateTimeTypeTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/DateTimeTypeTest.java @@ -241,8 +241,7 @@ public class DateTimeTypeTest { /** * setup Test class with current parameter map. * - * @param parameterMap - * parameter map + * @param parameterMap parameter map */ public DateTimeTypeTest(ParameterSet parameterSet) { this.parameterSet = parameterSet; diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/HSBTypeTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/HSBTypeTest.java index a67ad9908..cef88d1a7 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/HSBTypeTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/HSBTypeTest.java @@ -21,8 +21,8 @@ import org.junit.Test; /** * - * @author Chris Jackson - added fromRGB() test - * @author Stefan Triller - more tests for type conversions + * @author Chris Jackson - Initial contribution + * @author Stefan Triller - More tests for type conversions */ public class HSBTypeTest { diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/PercentTypeTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/PercentTypeTest.java index 2439361b2..a8aeb4af1 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/PercentTypeTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/PercentTypeTest.java @@ -28,18 +28,18 @@ public class PercentTypeTest { } @Test(expected = IllegalArgumentException.class) - public void MoreThan100() { + public void moreThan100() { new PercentType("100.2"); } @Test - public void DoubleValue() { + public void doubleValue() { PercentType pt = new PercentType("0.0001"); assertEquals("0.0001", pt.toString()); } @Test - public void IntValue() { + public void intValue() { PercentType pt = new PercentType(100); assertEquals("100", pt.toString()); } diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/QuantityTypeTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/QuantityTypeTest.java index 6e7c40e9e..131bf64d0 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/QuantityTypeTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/QuantityTypeTest.java @@ -208,27 +208,27 @@ public class QuantityTypeTest { } @Test - public void testMultiply_Number() { + public void testMultiplyNumber() { assertThat(new QuantityType<>("2 m").multiply(BigDecimal.valueOf(2)), is(new QuantityType<>("4 m"))); } @Test - public void testMultiply_QuantityType() { + public void testMultiplyQuantityType() { assertThat(new QuantityType<>("2 m").multiply(new QuantityType<>("4 cm")), is(new QuantityType<>("8 m·cm"))); } @Test - public void testDivide_Number() { + public void testDivideNumber() { assertThat(new QuantityType<>("4 m").divide(BigDecimal.valueOf(2)), is(new QuantityType<>("2 m"))); } @Test - public void testDivide_QuantityType() { + public void testDivideQuantityType() { assertThat(new QuantityType<>("4 m").divide(new QuantityType<>("2 cm")), is(new QuantityType<>("2 m/cm"))); } @Test(expected = ArithmeticException.class) - public void testDivide_Zero() { + public void testDivideZero() { new QuantityType<>("4 m").divide(QuantityType.ZERO); } diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/StringListTypeTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/StringListTypeTest.java index c0e28d819..57f3514b6 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/StringListTypeTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/types/StringListTypeTest.java @@ -21,20 +21,21 @@ import org.junit.Test; * @author Kai Kreuzer - added tests for valueOf and toFullString */ public class StringListTypeTest { + @Test - public void testSerializedEquals_simple() { - final int DEST_IDX = 0; - final int ORIG_IDX = 1; + public void testSerializedEqualsSimple() { + final int destIdx = 0; + final int origIdx = 1; StringListType call1 = new StringListType("0179999998", "0699222222"); StringListType call2 = new StringListType("0699222222,0179999998"); - assertEquals(call1.getValue(ORIG_IDX), call2.getValue(DEST_IDX)); + assertEquals(call1.getValue(origIdx), call2.getValue(destIdx)); assertEquals(call2.toString(), "0699222222,0179999998"); } @Test - public void testSerializedEquals_withEscapedEntries() { + public void testSerializedEqualsWithEscapedEntries() { String serialized = "value1,value2,value=with=foo,value\\,with\\,foo,,\\,\\,foo"; StringListType call4 = new StringListType(serialized); @@ -87,7 +88,7 @@ public class StringListTypeTest { } @Test - public void testValueOf_simple() { + public void testValueOfSimple() { StringListType abc = StringListType.valueOf("a,b,c"); assertEquals("a", abc.getValue(0)); assertEquals("b", abc.getValue(1)); @@ -95,7 +96,7 @@ public class StringListTypeTest { } @Test - public void testValueOf_withEscapedEntries() { + public void testValueOfWithEscapedEntries() { StringListType abC = StringListType.valueOf("a\\,b,c"); assertEquals("a,b", abC.getValue(0)); assertEquals("c", abC.getValue(1)); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/unit/SmartHomeUnitsTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/unit/SmartHomeUnitsTest.java index 8f49b903d..30c8f6382 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/unit/SmartHomeUnitsTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/library/unit/SmartHomeUnitsTest.java @@ -45,7 +45,7 @@ public class SmartHomeUnitsTest { private static final double DEFAULT_ERROR = 0.0000000000000001d; @Test - public void testinHg2PascalConversion() { + public void testInHg2PascalConversion() { Quantity inHg = Quantities.getQuantity(BigDecimal.ONE, ImperialUnits.INCH_OF_MERCURY); assertThat(inHg.to(SIUnits.PASCAL), is(Quantities.getQuantity(new BigDecimal("3386.388"), SIUnits.PASCAL))); @@ -54,7 +54,7 @@ public class SmartHomeUnitsTest { } @Test - public void test_inHg_UnitSymbol() { + public void testInHgUnitSymbol() { assertThat(ImperialUnits.INCH_OF_MERCURY.getSymbol(), is("inHg")); assertThat(ImperialUnits.INCH_OF_MERCURY.toString(), is("inHg")); } @@ -77,7 +77,7 @@ public class SmartHomeUnitsTest { } @Test - public void test_mmHg_UnitSymbol() { + public void testMmHgUnitSymbol() { assertThat(SmartHomeUnits.MILLIMETRE_OF_MERCURY.getSymbol(), is("mmHg")); assertThat(SmartHomeUnits.MILLIMETRE_OF_MERCURY.toString(), is("mmHg")); } @@ -98,7 +98,7 @@ public class SmartHomeUnitsTest { } @Test - public void test_hPa_UnitSymbol() { + public void testHpaUnitSymbol() { assertThat(HECTO(SIUnits.PASCAL).toString(), is("hPa")); } @@ -164,7 +164,7 @@ public class SmartHomeUnitsTest { } @Test - public void test_knot_UnitSymbol() { + public void testKnotUnitSymbol() { assertThat(SmartHomeUnits.KNOT.getSymbol(), is("kn")); assertThat(SmartHomeUnits.KNOT.toString(), is("kn")); } @@ -206,25 +206,25 @@ public class SmartHomeUnitsTest { } @Test - public void test_fahrenheit_UnitSymbol() { + public void testFahrenheitUnitSymbol() { assertThat(ImperialUnits.FAHRENHEIT.getSymbol(), is("°F")); assertThat(ImperialUnits.FAHRENHEIT.toString(), is("°F")); } @Test - public void test_inch_UnitSymbol() { + public void testInchUnitSymbol() { assertThat(ImperialUnits.INCH.getSymbol(), is("in")); assertThat(ImperialUnits.INCH.toString(), is("in")); } @Test - public void test_mile_UnitSymbol() { + public void testMileUnitSymbol() { assertThat(ImperialUnits.MILE.getSymbol(), is("mi")); assertThat(ImperialUnits.MILE.toString(), is("mi")); } @Test - public void test_one_UnitSymbol() { + public void testOneUnitSymbol() { assertThat(SmartHomeUnits.ONE.getSymbol(), is("")); Quantity one1 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.ONE); @@ -262,8 +262,8 @@ public class SmartHomeUnitsTest { @Test public void testMicrogramPerCubicMeter2KilogramPerCubicMeter() { - Quantity one_kg_m3 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.KILOGRAM_PER_CUBICMETRE); - Quantity converted = one_kg_m3.to(SmartHomeUnits.MICROGRAM_PER_CUBICMETRE); + Quantity oneKgM3 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.KILOGRAM_PER_CUBICMETRE); + Quantity converted = oneKgM3.to(SmartHomeUnits.MICROGRAM_PER_CUBICMETRE); assertThat(converted.getValue().doubleValue(), is(closeTo(1000000000, DEFAULT_ERROR))); } @@ -279,8 +279,8 @@ public class SmartHomeUnitsTest { @Test public void testMicrowattPerSquareCentimetre2KilogramPerSquareCentiMetre() { - Quantity one_mw_cm2 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.IRRADIANCE); - Quantity converted = one_mw_cm2.to(SmartHomeUnits.MICROWATT_PER_SQUARE_CENTIMETRE); + Quantity oneMwCm2 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.IRRADIANCE); + Quantity converted = oneMwCm2.to(SmartHomeUnits.MICROWATT_PER_SQUARE_CENTIMETRE); assertThat(converted.getValue().doubleValue(), is(closeTo(0.01, DEFAULT_ERROR))); } diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/types/util/UnitUtilsTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/types/util/UnitUtilsTest.java index c748480d5..dc2fa6ca2 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/types/util/UnitUtilsTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/types/util/UnitUtilsTest.java @@ -37,13 +37,13 @@ import org.junit.Test; public class UnitUtilsTest { @Test - public void forBaseUnitsOfDifferentSystems_shouldBeTrue() { + public void forBaseUnitsOfDifferentSystemsShouldBeTrue() { assertTrue(UnitUtils.isDifferentMeasurementSystem(SIUnits.CELSIUS, ImperialUnits.FAHRENHEIT)); assertTrue(UnitUtils.isDifferentMeasurementSystem(ImperialUnits.MILES_PER_HOUR, SIUnits.KILOMETRE_PER_HOUR)); } @Test - public void forBaseUnitsOfSameSystem_ShouldBeFalse() { + public void forBaseUnitsOfSameSystemShouldBeFalse() { assertFalse(UnitUtils.isDifferentMeasurementSystem(CENTI(SIUnits.METRE), SIUnits.METRE)); assertFalse(UnitUtils.isDifferentMeasurementSystem(SIUnits.METRE, MILLI(SIUnits.METRE))); assertFalse(UnitUtils.isDifferentMeasurementSystem(CENTI(SIUnits.METRE), MILLI(SIUnits.METRE))); @@ -52,13 +52,13 @@ public class UnitUtilsTest { } @Test - public void forDerivedUnitsOfDifferentSystems_shouldBeTrue() { + public void forDerivedUnitsOfDifferentSystemsShouldBeTrue() { assertTrue(UnitUtils.isDifferentMeasurementSystem(CENTI(SIUnits.METRE), ImperialUnits.INCH)); assertTrue(UnitUtils.isDifferentMeasurementSystem(ImperialUnits.MILE, KILO(SIUnits.METRE))); } @Test - public void whenValidDimensionIsGiven_shouldCreateQuantityClass() { + public void whenValidDimensionIsGivenShouldCreateQuantityClass() { Class> temperature = UnitUtils.parseDimension("Temperature"); assertNotNull(temperature); assertTrue(Temperature.class.isAssignableFrom(temperature)); diff --git a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/util/HexUtilsTest.java b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/util/HexUtilsTest.java index 21122af4d..bcc7a8c1f 100644 --- a/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/util/HexUtilsTest.java +++ b/bundles/org.openhab.core/src/test/java/org/eclipse/smarthome/core/util/HexUtilsTest.java @@ -25,40 +25,40 @@ import org.junit.Test; public class HexUtilsTest { @Test - public void test_bytesToHex_noParams() { + public void testBytesToHexNoParams() { byte[] bytes = "ABCD".getBytes(); String result = HexUtils.bytesToHex(bytes); assertEquals("41424344", result); } @Test - public void test_hexToBytes_noParams() { + public void testHexToBytesNoParams() { byte[] result = HexUtils.hexToBytes("41424344"); assertEquals("ABCD", new String(result)); } @Test - public void test_bytesToHex_withDelimiter() { + public void testBytesToHexWithDelimiter() { byte[] bytes = "ABCD".getBytes(); String result = HexUtils.bytesToHex(bytes, " "); assertEquals("41 42 43 44", result); } @Test - public void test_hexToBytes_withDelimiter() { + public void testHexToBytesWithDelimiter() { byte[] result = HexUtils.hexToBytes("41 42 43 44", " "); assertEquals("ABCD", new String(result)); } @Test - public void test_bytesToHex_withMultiCharDelimiter() { + public void testBytesToHexWithMultiCharDelimiter() { byte[] bytes = "ABCD".getBytes(); String result = HexUtils.bytesToHex(bytes, "-:-"); assertEquals("41-:-42-:-43-:-44", result); } @Test - public void test_hexToBytes_withMultiCharDelimiter() { + public void testHexToBytesWithMultiCharDelimiter() { byte[] result = HexUtils.hexToBytes("41-:-42-:-43-:-44", "-:-"); assertEquals("ABCD", new String(result)); } diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/moduletypes/CustomActionsTypeDefinition.json b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/moduletypes/CustomActionsTypeDefinition.json index 748f2960f..40f78f89a 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/moduletypes/CustomActionsTypeDefinition.json +++ b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/moduletypes/CustomActionsTypeDefinition.json @@ -1,32 +1,32 @@ -{ - "actions":[ - { - "uid":"CustomAction1", - "label":"CustomAction1", - "outputs":[ - { - "name":"customActionOutput3", - "type":"outputType3", - "label":"CustomActionOutput1 label", - "description":"Custom action output.", - "defaultValue":"{\"command\":\"OFF\"}", - "required":false - } - ] - }, - { - "uid":"CustomAction2", - "label":"CustomAction2", - "inputs":[ - { - "name":"customActionInput", - "type":"outputType4", - "label":"CustomActionOutput2 label", - "description":"Custom action output.", - "defaultValue":5, - "required":false - } - ] - } - ] +{ + "actions": [ + { + "uid": "CustomAction1", + "label": "CustomAction1", + "outputs": [ + { + "name": "customActionOutput3", + "type": "outputType3", + "label": "CustomActionOutput1 label", + "description": "Custom action output.", + "defaultValue": "{\"command\":\"OFF\"}", + "required": false + } + ] + }, + { + "uid": "CustomAction2", + "label": "CustomAction2", + "inputs": [ + { + "name": "customActionInput", + "type": "outputType4", + "label": "CustomActionOutput2 label", + "description": "Custom action output.", + "defaultValue": 5, + "required": false + } + ] + } + ] } diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/moduletypes/CustomTriggersTypeDefinition.json b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/moduletypes/CustomTriggersTypeDefinition.json index 7f6700f86..ddb5c6759 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/moduletypes/CustomTriggersTypeDefinition.json +++ b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/moduletypes/CustomTriggersTypeDefinition.json @@ -1,32 +1,32 @@ -{ - "triggers":[ - { - "uid":"CustomTrigger1", - "label":"Custom Event Trigger", - "outputs":[ - { - "name":"customTriggerOutput1", - "type":"outputType1", - "label":"CustomTriggerOutput1 label", - "description":"Custom trigger output.", - "defaultValue":true, - "reference":"${event}" - } - ] - }, - { - "uid":"CustomTrigger2", - "label":"Custom Event Trigger", - "outputs":[ - { - "name":"customTriggerOutput2", - "type":"outputType2", - "label":"CustomTriggerOutput2 label", - "description":"Custom trigger output.", - "defaultValue":"event", - "reference":"${event}" - } - ] - } - ] +{ + "triggers": [ + { + "uid": "CustomTrigger1", + "label": "Custom Event Trigger", + "outputs": [ + { + "name": "customTriggerOutput1", + "type": "outputType1", + "label": "CustomTriggerOutput1 label", + "description": "Custom trigger output.", + "defaultValue": true, + "reference": "${event}" + } + ] + }, + { + "uid": "CustomTrigger2", + "label": "Custom Event Trigger", + "outputs": [ + { + "name": "customTriggerOutput2", + "type": "outputType2", + "label": "CustomTriggerOutput2 label", + "description": "Custom trigger output.", + "defaultValue": "event", + "reference": "${event}" + } + ] + } + ] } diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/rules/ItemRuleDefinition.json b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/rules/ItemRuleDefinition.json index 208115030..e9fe5f865 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/rules/ItemRuleDefinition.json +++ b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/rules/ItemRuleDefinition.json @@ -1,51 +1,53 @@ -[ - { - "name": "ItemSampleRule", - "uid": "ItemSampleRule", - "tags": [ - "sample", - "item", - "jsonTest", - "rule" - ], - "configuration": {}, - "description": "Sample Rule for items definition.", - "triggers": [ - { - "id": "ItemStateChangeTriggerID", - "type": "core.GenericEventTrigger", - "configuration":{ - "eventSource":"myMotionItem", - "eventTopic":"smarthome/items/*", - "eventTypes":"ItemStateEvent" +[ + { + "name": "ItemSampleRule", + "uid": "ItemSampleRule", + "tags": [ + "sample", + "item", + "jsonTest", + "rule" + ], + "configuration": { + + }, + "description": "Sample Rule for items definition.", + "triggers": [ + { + "id": "ItemStateChangeTriggerID", + "type": "core.GenericEventTrigger", + "configuration": { + "eventSource": "myMotionItem", + "eventTopic": "smarthome/items/*", + "eventTypes": "ItemStateEvent" + } + } + ], + "actions": [ + { + "id": "ItemPostCommandActionID", + "type": "core.ItemCommandAction", + "configuration": { + "itemName": "myLampItem", + "command": "ON" + } + } + ] + }, + { + "uid": "ItemSampleRuleWithReferences", + "name": "ItemSampleRuleWithReferences", + "templateUID": "TemplateSampleRuleWithReferences", + "tags": [ + "sample", + "item", + "jsonTest", + "rule", + "references" + ], + "configuration": { + "triggerItem": "myMotionItem", + "actionItem": "myLampItem" } - } - ], - "actions": [ - { - "id": "ItemPostCommandActionID", - "type": "core.ItemCommandAction", - "configuration": { - "itemName": "myLampItem", - "command": "ON" - } - } - ] - }, - { - "uid": "ItemSampleRuleWithReferences", - "name": "ItemSampleRuleWithReferences", - "templateUID": "TemplateSampleRuleWithReferences", - "tags": [ - "sample", - "item", - "jsonTest", - "rule", - "references" - ], - "configuration": { - "triggerItem": "myMotionItem", - "actionItem": "myLampItem" - } - } + } ] diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/SimpleTestTemplate.json b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/SimpleTestTemplate.json index eb0149194..bd6561d85 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/SimpleTestTemplate.json +++ b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/SimpleTestTemplate.json @@ -1,59 +1,59 @@ -[ - { - "uid":"SimpleTestTemplate", - "description":"Sample Rule Template.", - "tags":[ - "sample", - "rule", - "template", - "simple" - ], - "configDescriptions":[ - { - "name":"onItem", - "type":"TEXT", - "description":"ItemName which state change triggers the rule", - "required":true - }, - { - "name":"ifState", - "type":"TEXT", - "description":"Right operand which is compared with the input.", - "required":true - }, - { - "name":"updateItem", - "type":"TEXT", - "description":"Item which should be updated", - "required":true - }, - { - "name":"updateCommand", - "type":"TEXT", - "description":"Command which should be sent to updateItem", - "required":true - } - ], - "triggers":[ - { - "id":"ItemUpdateTrigger_1", - "type":"core.GenericEventTrigger", - "configuration":{ - "eventSource":"${onItem}", - "eventTopic":"smarthome/items/*", - "eventTypes":"ItemStateEvent" - } - } - ], - "actions":[ - { - "id":"ItemPostCommandActionID_1", - "type":"core.ItemCommandAction", - "configuration":{ - "itemName":"${updateItem}", - "command":"${updateCommand}" - } - } - ] - } +[ + { + "uid": "SimpleTestTemplate", + "description": "Sample Rule Template.", + "tags": [ + "sample", + "rule", + "template", + "simple" + ], + "configDescriptions": [ + { + "name": "onItem", + "type": "TEXT", + "description": "ItemName which state change triggers the rule", + "required": true + }, + { + "name": "ifState", + "type": "TEXT", + "description": "Right operand which is compared with the input.", + "required": true + }, + { + "name": "updateItem", + "type": "TEXT", + "description": "Item which should be updated", + "required": true + }, + { + "name": "updateCommand", + "type": "TEXT", + "description": "Command which should be sent to updateItem", + "required": true + } + ], + "triggers": [ + { + "id": "ItemUpdateTrigger_1", + "type": "core.GenericEventTrigger", + "configuration": { + "eventSource": "${onItem}", + "eventTopic": "smarthome/items/*", + "eventTypes": "ItemStateEvent" + } + } + ], + "actions": [ + { + "id": "ItemPostCommandActionID_1", + "type": "core.ItemCommandAction", + "configuration": { + "itemName": "${updateItem}", + "command": "${updateCommand}" + } + } + ] + } ] diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/TestTemplateRuleWithReferences.json b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/TestTemplateRuleWithReferences.json index e1319f1bc..2c94dfc24 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/TestTemplateRuleWithReferences.json +++ b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/TestTemplateRuleWithReferences.json @@ -1,62 +1,62 @@ -[ - { - "name": "TemplateSampleRuleWithReferences", - "uid": "TemplateSampleRuleWithReferences", - "tags": [ - "sample", - "item", - "jsonTest", - "rule", - "references" - ], - "configDescriptions": [ - { - "name":"triggerItem", - "type":"TEXT", - "description":"ItemName which state change triggers the rule", - "required":true - }, - { - "name":"actionItem", - "type":"TEXT", - "description":"ItemName on which action will be performed.", - "required":true - } - ], - "description": "Sample Rule for items definition.", - "triggers": [ - { - "id": "ItemStateChangeTriggerID", - "type": "core.GenericEventTrigger", - "configuration":{ - "eventSource":"${triggerItem}", - "eventTopic":"smarthome/items/*", - "eventTypes":"ItemStateEvent" - } - } - ], - "conditions": [ - { - "id": "ItemStateConditionID", - "type": "core.GenericEventCondition", - "configuration": { - "topic": "smarthome/items/${triggerItem}/state", - "payload":".*ON.*" - }, - "inputs":{ - "event":"ItemStateChangeTriggerID.event" - } - } - ], - "actions": [ - { - "id": "ItemPostCommandActionID", - "type": "core.ItemCommandAction", - "configuration": { - "itemName": "${actionItem}", - "command": "ON" - } - } - ] - } +[ + { + "name": "TemplateSampleRuleWithReferences", + "uid": "TemplateSampleRuleWithReferences", + "tags": [ + "sample", + "item", + "jsonTest", + "rule", + "references" + ], + "configDescriptions": [ + { + "name": "triggerItem", + "type": "TEXT", + "description": "ItemName which state change triggers the rule", + "required": true + }, + { + "name": "actionItem", + "type": "TEXT", + "description": "ItemName on which action will be performed.", + "required": true + } + ], + "description": "Sample Rule for items definition.", + "triggers": [ + { + "id": "ItemStateChangeTriggerID", + "type": "core.GenericEventTrigger", + "configuration": { + "eventSource": "${triggerItem}", + "eventTopic": "smarthome/items/*", + "eventTypes": "ItemStateEvent" + } + } + ], + "conditions": [ + { + "id": "ItemStateConditionID", + "type": "core.GenericEventCondition", + "configuration": { + "topic": "smarthome/items/${triggerItem}/state", + "payload": ".*ON.*" + }, + "inputs": { + "event": "ItemStateChangeTriggerID.event" + } + } + ], + "actions": [ + { + "id": "ItemPostCommandActionID", + "type": "core.ItemCommandAction", + "configuration": { + "itemName": "${actionItem}", + "command": "ON" + } + } + ] + } ] diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/TestTemplateWithCompositeModules.json b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/TestTemplateWithCompositeModules.json index 1350227e2..b05ae0ec1 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/TestTemplateWithCompositeModules.json +++ b/itests/org.openhab.core.automation.integration.tests/src/main/resources/ESH-INF/automation/templates/TestTemplateWithCompositeModules.json @@ -1,57 +1,57 @@ -[ - { - "uid":"TestTemplateWithCompositeModules", - "description":"Sample Rule Template.", - "tags":[ - "sample", - "rule", - "template", - "composite" - ], - "configDescriptions":[ - { - "name":"onItem", - "type":"TEXT", - "description":"ItemName which state change triggers the rule", - "required":true - }, - { - "name":"ifState", - "type":"TEXT", - "description":"Right operand which is compared with the input.", - "required":true - }, - { - "name":"updateItem", - "type":"TEXT", - "description":"Item which should be updated", - "required":true - }, - { - "name":"updateCommand", - "type":"TEXT", - "description":"Command which should be sent to updateItem", - "required":true - } - ], - "triggers":[ - { - "id":"ItemUpdateTrigger_2", - "type":"core.ItemStateChangeTrigger", - "configuration":{ - "itemName":"${onItem}" - } - } - ], - "actions":[ - { - "id":"ItemPostCommandActionID_1", - "type":"core.ItemCommandAction", - "configuration":{ - "itemName":"${updateItem}", - "command":"${updateCommand}" - } - } - ] - } +[ + { + "uid": "TestTemplateWithCompositeModules", + "description": "Sample Rule Template.", + "tags": [ + "sample", + "rule", + "template", + "composite" + ], + "configDescriptions": [ + { + "name": "onItem", + "type": "TEXT", + "description": "ItemName which state change triggers the rule", + "required": true + }, + { + "name": "ifState", + "type": "TEXT", + "description": "Right operand which is compared with the input.", + "required": true + }, + { + "name": "updateItem", + "type": "TEXT", + "description": "Item which should be updated", + "required": true + }, + { + "name": "updateCommand", + "type": "TEXT", + "description": "Command which should be sent to updateItem", + "required": true + } + ], + "triggers": [ + { + "id": "ItemUpdateTrigger_2", + "type": "core.ItemStateChangeTrigger", + "configuration": { + "itemName": "${onItem}" + } + } + ], + "actions": [ + { + "id": "ItemPostCommandActionID_1", + "type": "core.ItemCommandAction", + "configuration": { + "itemName": "${updateItem}", + "command": "${updateCommand}" + } + } + ] + } ] diff --git a/itests/org.openhab.core.automation.module.script.tests/src/main/resources/ESH-INF/automation/rules/DemoScriptRule.json b/itests/org.openhab.core.automation.module.script.tests/src/main/resources/ESH-INF/automation/rules/DemoScriptRule.json index b1b0c397a..de6d6b07a 100644 --- a/itests/org.openhab.core.automation.module.script.tests/src/main/resources/ESH-INF/automation/rules/DemoScriptRule.json +++ b/itests/org.openhab.core.automation.module.script.tests/src/main/resources/ESH-INF/automation/rules/DemoScriptRule.json @@ -1,38 +1,38 @@ -[ - { - "uid": "javascript.rule1", - "name": "DemoScriptRule", - "description": "Sample rule based on scripts", - "triggers": [ - { - "id": "trigger", - "type": "core.GenericEventTrigger", - "configuration":{ - "eventSource":"MyTrigger", - "eventTopic":"smarthome/items/MyTrigger/state", - "eventTypes":"ItemStateEvent" - } - } - ], - "conditions": [ - { - "id": "condition", - "type": "script.ScriptCondition", - "configuration": { - "type": "application/javascript", - "script": "event.itemState==ON" - } - } - ], - "actions": [ - { - "id": "action", - "type": "script.ScriptAction", - "configuration": { - "type": "application/javascript", - "script": "print(items.MyTrigger), print(things.getAll()), print(ctx.get('trigger.event')), events.sendCommand('ScriptItem', 'ON')" - } - } - ] - } +[ + { + "uid": "javascript.rule1", + "name": "DemoScriptRule", + "description": "Sample rule based on scripts", + "triggers": [ + { + "id": "trigger", + "type": "core.GenericEventTrigger", + "configuration": { + "eventSource": "MyTrigger", + "eventTopic": "smarthome/items/MyTrigger/state", + "eventTypes": "ItemStateEvent" + } + } + ], + "conditions": [ + { + "id": "condition", + "type": "script.ScriptCondition", + "configuration": { + "type": "application/javascript", + "script": "event.itemState==ON" + } + } + ], + "actions": [ + { + "id": "action", + "type": "script.ScriptAction", + "configuration": { + "type": "application/javascript", + "script": "print(items.MyTrigger), print(things.getAll()), print(ctx.get('trigger.event')), events.sendCommand('ScriptItem', 'ON')" + } + } + ] + } ]