use of org.openhab.binding.exec.internal.ExecGenericBindingProvider.ExecBindingConfig in project openhab1-addons by openhab.
the class ExecGenericBindingProviderTest method testParseBindingConfig.
@Test
public void testParseBindingConfig() throws BindingConfigParseException {
ExecBindingConfig config = new ExecGenericBindingProvider.ExecBindingConfig();
String bindingConfig = "ON:some command to execute, OFF: 'other command with comma\\, and \\'quotes\\' and slashes \\\\ ', *:and a fallback";
SwitchItem item = new SwitchItem("");
provider.parseLegacyOutBindingConfig(item, bindingConfig, config);
Assert.assertEquals(3, config.size());
Assert.assertEquals("some command to execute", config.get(OnOffType.ON).commandLine);
Assert.assertEquals("other command with comma, and 'quotes' and slashes \\ ", config.get(OnOffType.OFF).commandLine);
Assert.assertEquals("and a fallback", config.get(StringType.valueOf("*")).commandLine);
}
Aggregations