File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1111
1212import static org .junit .Assert .assertTrue ;
1313
14- public class ScreenshotTest {
14+ public class ScreenshotUnitTest {
1515
1616 @ Test
17- public void takeScreenshotOfMainScreen () throws Exception {
17+ public void givenMainScreen_whenTakeScreenshot_thenSaveToFile () throws Exception {
1818 Rectangle screenRect = new Rectangle (Toolkit .getDefaultToolkit ().getScreenSize ());
1919 BufferedImage capture = new Robot ().createScreenCapture (screenRect );
2020 File imageFile = File .createTempFile ("single-screen" , "bmp" );
@@ -23,7 +23,7 @@ public void takeScreenshotOfMainScreen() throws Exception {
2323 }
2424
2525 @ Test
26- public void takeScreenshotOfAllScreens () throws Exception {
26+ public void givenMultipleScreens_whenTakeScreenshot_thenSaveToFile () throws Exception {
2727 GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment ();
2828 GraphicsDevice [] screens = ge .getScreenDevices ();
2929 Rectangle allScreenBounds = new Rectangle ();
@@ -39,7 +39,7 @@ public void takeScreenshotOfAllScreens() throws Exception {
3939 }
4040
4141 @ Test
42- public void makeScreenshot (Component component ) throws Exception {
42+ public void givenComponent_whenTakeScreenshot_thenSaveToFile (Component component ) throws Exception {
4343 Rectangle componentRect = component .getBounds ();
4444 BufferedImage bufferedImage = new BufferedImage (componentRect .width , componentRect .height , BufferedImage .TYPE_INT_ARGB );
4545 component .paint (bufferedImage .getGraphics ());
You can’t perform that action at this time.
0 commit comments