initFirstDevice();
final AttributeBooleanComboCometeV2 widget = new AttributeBooleanComboCometeV2.Builder(
m_deviceName, attributeName).jframe(jf1).build();
Sleeper.SECONDS.sleep(4);
final BooleanAttributeListenerImpl listenerSpy = new BooleanAttributeListenerImpl();
widget.addBooleanAttributeListener(listenerSpy);
switchComboBoxState(widget);
// wait for notification, normally all notification come at the same
// time, so we wait only
// one
assertThat(listenerSpy.isLaterNotified("readBooleanValueChange", 3000))
.isTrue();
assertThat(
(Boolean) listenerSpy.getNotification("readBooleanValueChange"))
.isFalse();
assertThat(
(Boolean) listenerSpy
.getNotification("writeBooleanValueChange")).isFalse();
// FIXME : listener stateChange always return 'null' instead of 'VALID'
// assertThat((String) listenerSpy.getNotification("stateChange"))
// .isEqualTo("VALID");
// check listener is notify only one time.
Sleeper.SECONDS.sleep(3);
// FIXME Listener notify 4 times in ATK Test (but bugged)
assertThat(listenerSpy.getNotifyCount()).isEqualTo(2);
// switch state and check update is notify
switchComboBoxState(widget);
// wait notification updata
Sleeper.SECONDS.sleep(1);
assertThat(
(Boolean) listenerSpy.getNotification("readBooleanValueChange"))
.isTrue();
assertThat(
(Boolean) listenerSpy
.getNotification("writeBooleanValueChange")).isTrue();
// FIXME : listener stateChange always return 'null' instead of 'VALID'
// assertThat((String) listenerSpy.getNotification("stateChange"))
// .isEqualTo("VALID");
// TODO change the attr quality, to change quality of boolean attr you
// must code it in
// device !
// with IDL4 Java device, we need to have an dynamic attr. So this test
// will be implemented
// when TestGlobalScreen will be upgraded to have dynamic attr
// check listener is no more notify if it's removed
widget.removeBooleanAttributeListener(listenerSpy);
listenerSpy.reset();
switchComboBoxState(widget);
assertThat(listenerSpy.getNotifyCount()).isEqualTo(0);
widget.stop();
jf1.dispose();
}