2828 * POSSIBILITY OF SUCH DAMAGE.
2929 * #L%
3030 */
31+
3132package org .scijava .app ;
3233
3334import static org .junit .Assert .assertEquals ;
4849import org .scijava .plugin .Parameter ;
4950
5051public class DefaultStatusServiceTest {
51- Context context ;
52- StatusListener statusListener ;
53- BlockingQueue <StatusEvent > queue ;
54- StatusService statusService ;
55- class StatusListener extends AbstractContextual {
56- int progress ;
57- int maximum ;
58- String status ;
59- boolean warning ;
52+
53+ private Context context ;
54+ private StatusListener statusListener ;
55+ private BlockingQueue <StatusEvent > queue ;
56+ private StatusService statusService ;
57+
58+ private class StatusListener extends AbstractContextual {
59+
6060 @ Parameter
61- StatusService statusService ;
62-
61+ private StatusService statusService ;
62+
6363 @ EventHandler
64- void eventHandler (StatusEvent e ) {
64+ private void eventHandler (final StatusEvent e ) {
6565 try {
66- queue .put (new StatusEvent (
67- e .getProgressValue (),
68- e .getProgressMaximum (),
69- e .getStatusMessage (),
70- e .isWarning ()));
71- } catch (InterruptedException e1 ) {
66+ queue .put (new StatusEvent (e .getProgressValue (), e .getProgressMaximum (),
67+ e .getStatusMessage (), e .isWarning ()));
68+ }
69+ catch (final InterruptedException e1 ) {
7270 e1 .printStackTrace ();
7371 fail ();
7472 }
@@ -81,7 +79,7 @@ public void setUp() throws Exception {
8179 queue = new ArrayBlockingQueue <StatusEvent >(10 );
8280 statusListener = new StatusListener ();
8381 statusListener .setContext (context );
84- statusService = statusListener .statusService ;
82+ statusService = statusListener .statusService ;
8583 }
8684
8785 @ Test
@@ -92,7 +90,8 @@ public void testShowProgress() {
9290 assertEquals (event .getProgressValue (), 15 );
9391 assertEquals (event .getProgressMaximum (), 45 );
9492 assertFalse (event .isWarning ());
95- } catch (InterruptedException e ) {
93+ }
94+ catch (final InterruptedException e ) {
9695 e .printStackTrace ();
9796 fail ();
9897 }
@@ -106,7 +105,8 @@ public void testShowStatusString() {
106105 final StatusEvent event = queue .poll (10 , TimeUnit .SECONDS );
107106 assertEquals (event .getStatusMessage (), text );
108107 assertFalse (event .isWarning ());
109- } catch (InterruptedException e ) {
108+ }
109+ catch (final InterruptedException e ) {
110110 e .printStackTrace ();
111111 fail ();
112112 }
@@ -122,7 +122,8 @@ public void testShowStatusIntIntString() {
122122 assertEquals (event .getProgressMaximum (), 55 );
123123 assertEquals (event .getStatusMessage (), text );
124124 assertFalse (event .isWarning ());
125- } catch (InterruptedException e ) {
125+ }
126+ catch (final InterruptedException e ) {
126127 e .printStackTrace ();
127128 fail ();
128129 }
@@ -136,7 +137,8 @@ public void testWarn() {
136137 final StatusEvent event = queue .poll (10 , TimeUnit .SECONDS );
137138 assertEquals (event .getStatusMessage (), text );
138139 assertTrue (event .isWarning ());
139- } catch (InterruptedException e ) {
140+ }
141+ catch (final InterruptedException e ) {
140142 e .printStackTrace ();
141143 fail ();
142144 }
@@ -152,7 +154,8 @@ public void testShowStatusIntIntStringBoolean() {
152154 assertEquals (event .getProgressValue (), 33 );
153155 assertEquals (event .getProgressMaximum (), 44 );
154156 assertTrue (event .isWarning ());
155- } catch (InterruptedException e ) {
157+ }
158+ catch (final InterruptedException e ) {
156159 e .printStackTrace ();
157160 fail ();
158161 }
@@ -165,7 +168,8 @@ public void testClearStatus() {
165168 final StatusEvent event = queue .poll (10 , TimeUnit .SECONDS );
166169 assertEquals (event .getStatusMessage (), "" );
167170 assertFalse (event .isWarning ());
168- } catch (InterruptedException e ) {
171+ }
172+ catch (final InterruptedException e ) {
169173 e .printStackTrace ();
170174 fail ();
171175 }
0 commit comments