@@ -49,6 +49,8 @@ public class ExecuteWhen<T> {
4949 * the {@link ObservableValue} which will be observed by the created {@code Execute...When} instances
5050 */
5151 private ExecuteWhen (ObservableValue <T > observable ) {
52+ Objects .requireNonNull (observable , "The argument 'observable' must not be null." );
53+
5254 this .observable = observable ;
5355 condition = Optional .empty ();
5456 }
@@ -79,6 +81,7 @@ public static <T> ExecuteWhen<T> on(ObservableValue<T> observable) {
7981 */
8082 public ExecuteWhen <T > when (Predicate <? super T > condition ) {
8183 Objects .requireNonNull (condition , "The argument 'condition' must not be null." );
84+
8285 this .condition = Optional .of (condition );
8386 return this ;
8487 }
@@ -104,6 +107,8 @@ public ExecuteWhen<T> when(Predicate<? super T> condition) {
104107 * if {@link #when(Predicate)} was not called
105108 */
106109 public ExecuteOnceWhen <T > thenOnce (Consumer <? super T > action ) throws IllegalStateException {
110+ Objects .requireNonNull (action , "The argument 'action' must not be null." );
111+
107112 ensureConditionWasSet ();
108113 return new ExecuteOnceWhen <T >(observable , condition .get (), action );
109114 }
@@ -125,6 +130,8 @@ public ExecuteOnceWhen<T> thenOnce(Consumer<? super T> action) throws IllegalSta
125130 * if {@link #when(Predicate)} was not called
126131 */
127132 public ExecuteAlwaysWhen <T > thenAlways (Consumer <? super T > action ) throws IllegalStateException {
133+ Objects .requireNonNull (action , "The argument 'action' must not be null." );
134+
128135 ensureConditionWasSet ();
129136 return new ExecuteAlwaysWhen <T >(observable , condition .get (), action );
130137 }
@@ -139,7 +146,7 @@ private void ensureConditionWasSet() throws IllegalStateException {
139146 boolean noCondition = !condition .isPresent ();
140147 if (noCondition )
141148 throw new IllegalStateException (
142- "Set a condition with 'when(Predicate<? super T>)' before calling any 'then' method." );
149+ "Set a condition with 'when(Predicate<? super T>)' before calling any 'then... ' method." );
143150 }
144151
145152 // #end BUILD
0 commit comments