}
private void controlBooleanValueChange(final JComboBox combobox,
final AttributeBooleanComboCometeV2 widget) throws DevFailed {
final InputListenerImpl listenerTest = new InputListenerImpl();
widget.addInputListener(listenerTest);
assertTrue("Listener should not yet be called",
listenerTest.getNotifyCount() == 0);
final boolean newValue = switchComboBoxState(widget);
Sleeper.SECONDS.sleep(1);
assertTrue("InputListener has not been wake up on booleanValueChange",
listenerTest.isLaterNotified("booleanValueChange", 5000L));
final Object booleanNotification = listenerTest
.getNotification("booleanValueChange");
final boolean currentValueTest = (booleanNotification instanceof Boolean) ? ((Boolean) booleanNotification)
.booleanValue() : !newValue;
assertTrue(
"Value received in InputListener.booleanValueChange is not the good one",
currentValueTest == newValue);
Sleeper.SECONDS.sleep(2);
assertTrue("Listener should be called 6 times instead of "
+ listenerTest.getNotifyCount() + " time(s)",
listenerTest.getNotifyCount() == 6);
assertTrue("booleanValueChange method should be called", listenerTest
.getNotification("booleanValueChange").equals(newValue));
assertTrue("booleanValueChange method should be called", listenerTest
.getNotification("booleanValueChange").equals(newValue));
// check if the listener is correctly removed
widget.removeInputListener(listenerTest);
listenerTest.reset();
switchComboBoxState(widget);
assertFalse("InputListener has not been correctly removed",
listenerTest.isLaterNotified("booleanValueChange", 5000L));
}