@@ -116,7 +116,7 @@ public Integer apply(final Integer n) {
116116*/
117117
118118 @ Test
119- public void throttle () throws Exception {
119+ public void throttle () {
120120 final Integer [] counter = new Integer [] {0 };
121121 Supplier <Void > incr = new Supplier <Void >() { public Void get () {
122122 counter [0 ]++; return null ; } };
@@ -131,7 +131,7 @@ public Void get() {
131131 }
132132 }, 60 );
133133 await ().atMost (180 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
134- public Boolean call () throws Exception {
134+ public Boolean call () {
135135 throttleIncr .get ();
136136 return true ;
137137 }
@@ -148,7 +148,7 @@ public Boolean call() throws Exception {
148148*/
149149
150150 @ Test
151- public void debounce () throws Exception {
151+ public void debounce () {
152152 final Integer [] counter = new Integer [] {0 };
153153 Supplier <Void > incr = new Supplier <Void >() { public Void get () {
154154 counter [0 ]++; return null ; } };
@@ -162,8 +162,8 @@ public Void get() {
162162 return null ;
163163 }
164164 }, 60 );
165- await ().atMost (160 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
166- public Boolean call () throws Exception {
165+ await ().atMost (120 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
166+ public Boolean call () {
167167 return true ;
168168 }
169169 });
@@ -174,7 +174,7 @@ public Boolean call() throws Exception {
174174// Returns from the function before the alert runs.
175175*/
176176 @ Test
177- public void defer () throws Exception {
177+ public void defer () {
178178 final Integer [] counter = new Integer [] {0 };
179179 U .defer (new Supplier <Void >() { public Void get () {
180180 try {
@@ -185,11 +185,14 @@ public void defer() throws Exception {
185185 counter [0 ]++; return null ; } });
186186 assertEquals ("incr was debounced" , 0 , counter [0 ].intValue ());
187187 await ().atLeast (60 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
188- public Boolean call () throws Exception {
188+ public Boolean call () {
189189 assertEquals ("incr was debounced" , 1 , counter [0 ].intValue ());
190190 return true ;
191191 }
192192 });
193+ U .defer (new Runnable () { public void run () {
194+ }
195+ });
193196 }
194197
195198/*
@@ -199,15 +202,15 @@ public Boolean call() throws Exception {
199202// Application is only created once.
200203*/
201204 @ Test
202- public void once () throws Exception {
205+ public void once () {
203206 final Integer [] counter = new Integer [] {0 };
204207 Supplier <Integer > incr = new Supplier <Integer >() { public Integer get () {
205208 counter [0 ]++; return counter [0 ]; } };
206209 final Supplier <Integer > onceIncr = U .once (incr );
207210 onceIncr .get ();
208211 onceIncr .get ();
209212 await ().atLeast (60 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
210- public Boolean call () throws Exception {
213+ public Boolean call () {
211214 assertEquals ("incr was called only once" , 1 , counter [0 ].intValue ());
212215 assertEquals ("stores a memo to the last value" , 1 , onceIncr .get ().intValue ());
213216 return true ;
@@ -348,37 +351,37 @@ public void iteratee() {
348351 }
349352
350353 @ Test
351- public void setTimeout () throws Exception {
354+ public void setTimeout () {
352355 final Integer [] counter = new Integer [] {0 };
353356 Supplier <Void > incr = new Supplier <Void >() { public Void get () {
354357 counter [0 ]++; return null ; } };
355358 U .setTimeout (incr , 0 );
356359 await ().atLeast (40 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
357- public Boolean call () throws Exception {
360+ public Boolean call () {
358361 assertEquals (1 , counter [0 ].intValue ());
359362 return true ;
360363 }
361364 });
362365 }
363366
364367 @ Test
365- public void clearTimeout () throws Exception {
368+ public void clearTimeout () {
366369 final Integer [] counter = new Integer [] {0 };
367370 Supplier <Void > incr = new Supplier <Void >() { public Void get () {
368371 counter [0 ]++; return null ; } };
369372 java .util .concurrent .ScheduledFuture future = U .setTimeout (incr , 20 );
370373 U .clearTimeout (future );
371374 U .clearTimeout (null );
372375 await ().atLeast (40 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
373- public Boolean call () throws Exception {
376+ public Boolean call () {
374377 assertEquals (0 , counter [0 ].intValue ());
375378 return true ;
376379 }
377380 });
378381 }
379382
380383 @ Test
381- public void setInterval () throws Exception {
384+ public void setInterval () {
382385 final Integer [] counter = new Integer [] {0 };
383386 Supplier <Void > incr = new Supplier <Void >() { public Void get () {
384387 if (counter [0 ] < 4 ) {
@@ -387,7 +390,7 @@ public void setInterval() throws Exception {
387390 return null ; } };
388391 U .setInterval (incr , 10 );
389392 await ().atLeast (45 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
390- public Boolean call () throws Exception {
393+ public Boolean call () {
391394 assertTrue ("Counter is not in range [0, 4] " + counter [0 ],
392395 asList (0 , 4 ).contains (counter [0 ]));
393396 return true ;
@@ -396,15 +399,15 @@ public Boolean call() throws Exception {
396399 }
397400
398401 @ Test
399- public void clearInterval () throws Exception {
402+ public void clearInterval () {
400403 final Integer [] counter = new Integer [] {0 };
401404 Supplier <Void > incr = new Supplier <Void >() { public Void get () {
402405 counter [0 ]++; return null ; } };
403406 java .util .concurrent .ScheduledFuture future = U .setInterval (incr , 20 );
404407 U .clearInterval (future );
405408 U .clearInterval (null );
406409 await ().atLeast (40 , TimeUnit .MILLISECONDS ).until (new Callable <Boolean >() {
407- public Boolean call () throws Exception {
410+ public Boolean call () {
408411 assertEquals (0 , counter [0 ].intValue ());
409412 return true ;
410413 }
0 commit comments