Refactor Screenshot examples
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user