Refactor Screenshot examples

This commit is contained in:
Grzegorz Piwowarek
2016-10-20 23:10:14 +02:00
parent cdbd83e851
commit fd1a5796a9
3 changed files with 18 additions and 34 deletions

View File

@@ -1,34 +1,21 @@
package com.baeldung.printscreen;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
public class ScreenshotTest {
private Screenshot screenshot;
private String filePath;
private String fileName;
private String fileType;
private File file;
@Before
public void setUp() throws Exception {
filePath = "";
fileName = "Screenshot";
fileType = "jpg";
file = new File(filePath + fileName + "." + fileType);
screenshot = new Screenshot(filePath, fileName, fileType, 2000);
}
private Screenshot screenshot = new Screenshot("", "Screenshot", "jpg");
private File file = new File("Screenshot.jpg");
@Test
public void testGetScreenshot() throws Exception {
screenshot.getScreenshot();
screenshot.getScreenshot(2000);
assertTrue(file.exists());
}