01: package org.uispec4j.interception.handlers;
02:
03: import junit.framework.Assert;
04: import org.uispec4j.Window;
05:
06: public class ModalInterceptionCheckerHandler extends
07: AbstractInterceptionHandlerDecorator {
08: private boolean shouldBeModal;
09:
10: public ModalInterceptionCheckerHandler(
11: InterceptionHandler innerHandler, boolean shouldBeModal) {
12: super (innerHandler);
13: this .shouldBeModal = shouldBeModal;
14: }
15:
16: public void process(Window window) {
17: if (!shouldBeModal) {
18: if (window.isModal().isTrue()) {
19: Assert
20: .fail("Window '"
21: + window.getTitle()
22: + "' is modal, it must be intercepted with a WindowHandler");
23: }
24: } else {
25: if (!window.isModal().isTrue()) {
26: Assert
27: .fail("Window '"
28: + window.getTitle()
29: + "' is non-modal, it must be intercepted with WindowInterceptor.run(Trigger)");
30: }
31: }
32: super.process(window);
33: }
34: }
|