MeasurementThread implements Runnable { public void interrupt() { if (isRunning) { if (logThread != null) { try { setRunning(false); } catch (SecurityException ex) { Logger.getLogger(this.getClass()). warn("Internal error : Current Thread is not allow to interrupt the logThread in Logger.interrupt()"); } } else { if(listener!=null) listener.removeMylistener(); throw new NullPointerException( "Internal error : logThread is null in Logger.interrupt()"); } } } MeasurementThread(ResultLogger l); void logResourcesUsage(); void run(); void start(int iInterval); void interrupt(); void join(); boolean isAlive(); boolean isRunning();  }
@Test(expected = NullPointerException.class) public void testInterruptWithoutStart() throws FileNotFoundException { MeasurementThread m = new MeasurementThread(new ResultLogger( Platform.TMP_DIR, new TextGenerator(new FileOutputStream( new File(Platform.TMP_DIR + Platform.FILE_SEPARATOR + "tmp.txt"))),"C:\\Program Files\\JATK\\Salome-script\\Confile.xml")); m.interrupt(); }