use of org.csstudio.display.builder.model.widgets.MultiStateLEDWidget in project org.csstudio.display.builder by kasemir.
the class WidgetPropertiesUnitTest method testPropertyListing.
@Test
public void testPropertyListing() {
final Widget led = new MultiStateLEDWidget();
final List<String> names = new ArrayList<>();
for (WidgetProperty<?> property : led.getProperties()) names.addAll(Widget.expandPropertyNames(property));
System.out.println("Properties of " + led.getType());
for (String name : names) System.out.println(name);
assertThat(names, hasItem("name"));
assertThat(names, hasItem("states[1].color"));
// Check that all listed properties are actually found
for (String name : names) {
WidgetProperty<?> property = led.getProperty(name);
assertThat(name, property, not(nullValue()));
}
}
use of org.csstudio.display.builder.model.widgets.MultiStateLEDWidget in project org.csstudio.display.builder by kasemir.
the class WidgetPropertiesUnitTest method testPropertyPath.
@Test
public void testPropertyPath() {
final Widget led = new MultiStateLEDWidget();
final WidgetProperty<?> color1 = led.getProperty("states[1].color");
System.out.println(color1.getValue());
assertThat(color1.getValue().toString(), equalTo("On"));
try {
led.getProperty("states[1].bogus");
fail("Accessed bogus element");
} catch (IllegalArgumentException ex) {
System.out.println("Properly detected " + ex.getMessage());
assertThat(ex.getMessage(), containsString("bogus"));
}
}
Aggregations