@Test public void should_take_screenshot_of_desktop() throws Exception { String folder = concat(temporaryFolderPath(), "img"); filePaths = camera.saveDesktopAsPng(folder); GraphicsDevice[] displays = getLocalGraphicsEnvironment().getScreenDevices(); int displayCount = displays.length; assertThat(filePaths).hasSize(displayCount); for (int i = 0; i < displayCount; i++) { String imageFilePath = filePaths.get(i); BufferedImage screenshot = read(imageFilePath); assertThat(screenshot).hasSize(sizeOf(displays[i])); } }
@Before public void setUp() { camera = DesktopCamera.instance(); }