ResultLogger { public boolean saveScreenshot(String fileName, RenderedImage image) { if (fileName == null) { throw new NullPointerException("fileName is null"); } if (image == null) { throw new NullPointerException("image is null"); } File fichier = new File(folderWhereResultsAreSaved + Platform.FILE_SEPARATOR + "screenshots" + Platform.FILE_SEPARATOR + fileName + "." + EXT_PICTURE); File directory = new File(folderWhereResultsAreSaved + Platform.FILE_SEPARATOR + "screenshots"); if (!directory.exists()) { if (!directory.mkdirs()) Logger.getLogger(this.getClass()).warn("Can't make dir " + directory.getPath()); } try { if (!ImageIO.write(image, EXT_PICTURE, fichier)) { return false; } } catch (IOException e) { e.printStackTrace(); return false; } return true; } ResultLogger(String folderWhereResultsAreSaved,
			DocumentGenerator documentGenerator, String confilepath, boolean isResourceslogged);  ResultLogger(String folderWhereResultsAreSaved,
			DocumentGenerator documentGenerator, String confilepath); void generateGraphFile(); void generatepltFile(); void addInfotoActionLogger(String MsgType, String actionName, Date startTime,
			Date endTime); void writeActionLogFile(); void writeActionLogFile(String xmlfilepath); void addInfoToDocumentLogger(String s, int line, String currentScript); void addWarningToDocumentLogger(String s, int line, String currentScript); void addErrorToDocumentLogger(String s, int line, String currentScript); void addToDocumentLogger(float value, String doctype); void addResourcesInfoToDocumentLogger(); void addPerfListener(IMeasureListener listener); void removePerfListener(IMeasureListener listener); IMeasureListener[] getPerfListeners(); boolean saveScreenshot(String fileName, RenderedImage image); void setPhoneInterface(PhoneInterface phoneInterface); void setInterpreter(JATKInterpreter interpreter); void start(int iInterval); void interrupt(); void join(); boolean isAlive(); void dumpInStream(boolean isParseErrorHappened); PhoneInterface getPhoneInterface(); void setStopATK(boolean stopATK); boolean isStopATK(); DocumentLogger getDocumentLogger(); void setDocumentLogger(DocumentLogger documentLogger); ActionsLogger getActionsLogger();  }
@Test(expected=NullPointerException.class) public void testSaveScreenshotNullFileName() throws FileNotFoundException{ ResultLogger l = 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"); l.saveScreenshot(null, null); }
@Test(expected=NullPointerException.class) public void testSaveScreenshotNullImage() throws FileNotFoundException{ ResultLogger l = 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"); l.saveScreenshot("BOB", null ); }