@@ -129,21 +129,21 @@ public void tearDown() {
129129 } catch (InterruptedException ex ) {
130130 ex .printStackTrace ();
131131 }
132- s .closeLog ();
132+ if ( s != null ) s .closeLog ();
133133 //A shutdown hook kills all Rserve at the end.
134- r .closeLog ();
134+ if ( r != null ) r .closeLog ();
135135
136- q .closeLog ();
136+ if ( q != null ) q .closeLog ();
137137
138138 System .out .println ("========================================================================" );
139- System .out .println (s .notebook ());
140- System .out .println (r .notebook ());
141- System .out .println (q .notebook ());
139+ if ( s != null ) System .out .println (s .notebook ());
140+ if ( r != null ) System .out .println (r .notebook ());
141+ if ( q != null ) System .out .println (q .notebook ());
142142 System .out .println ("========================================================================" );
143-
144- s .end ();
145- r .end ();
146- q .end ();
143+
144+ if ( s != null ) s .end ();
145+ if ( r != null ) r .end ();
146+ if ( q != null ) q .end ();
147147 }
148148
149149 void frame (JPanel p ) {
@@ -199,6 +199,7 @@ public void testRLogPanel_Renjin() throws Exception {
199199
200200 @ Test
201201 public void testRLogPanel_R2js () throws Exception {
202+ assumeTrue ("R2js instance not initialized" , q != null );
202203 System .err .println ("====================================== testRLogPanel_R2js" );
203204 RLogPanel p = new RLogPanel ();
204205 q .addLogger (p );
@@ -256,6 +257,7 @@ public void testRLogPanel_RenjinError() throws Exception {
256257
257258 @ Test
258259 public void testRLogPanel_R2jsError () throws Exception {
260+ assumeTrue ("R2js instance not initialized" , q != null );
259261 System .err .println ("====================================== testRLogPanel_R2jsError" );
260262 RLogPanel p = new RLogPanel ();
261263 q .addLogger (p );
@@ -289,6 +291,7 @@ public void testRObjPanel_Renjin() throws Exception {
289291
290292 @ Test
291293 public void testRObjPanel_Rsession () throws Exception {
294+ assumeTrue ("At least one Rsession instance initialized" , s != null || r != null || q != null );
292295 System .err .println ("====================================== testRObjPanel_Rsession" );
293296 RObjectsPanel p = new RObjectsPanel (s );
294297 frame (p );
@@ -303,6 +306,7 @@ public void testRObjPanel_Rsession() throws Exception {
303306
304307 @ Test
305308 public void testRObjPanel_R2js () throws Exception {
309+ assumeTrue ("R2js instance not initialized" , q != null );
306310 System .err .println ("====================================== testRObjPanel_R2js" );
307311 RObjectsPanel p = new RObjectsPanel (q );
308312 frame (p );
0 commit comments