Skip to content

Commit

Permalink
improved test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
romankh3 committed Nov 23, 2019
1 parent 35a8744 commit 3d9363d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,6 @@ public static BufferedImage readImageFromResources(String path) throws ImageComp
}
}

/**
* Read image from the provided file path.
*
* @param path the path where contains image.
* @return the {@link BufferedImage} object of this specific image.
* @throws ImageComparisonException due to read the image from FS.
*/
public static BufferedImage readImageFromFile(File path) throws ImageComparisonException {
try {
return ImageIO.read(path);
} catch (IOException e) {
throw new ImageComparisonException(String.format("Can not read file from path=%s", path.getAbsolutePath()), e);
}
}

/**
* Save image to the provided path.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ public void testCorrectWorkingExpectedActual() {
File file = new File("build/test-images/result.png");

//when
ImageComparisonResult imageComparisonResult = new ImageComparison("expected.png", "actual.png")
.compareImages()
.writeResultTo(file);
ImageComparison imageComparison = new ImageComparison("expected.png", "actual.png");
ImageComparisonResult imageComparisonResult = imageComparison.compareImages().writeResultTo(file);

//then
assertNotNull(imageComparison.getActual());
assertNotNull(imageComparison.getExpected());
assertEquals(MISMATCH, imageComparisonResult.getImageComparisonState());
assertImagesEqual(expectedResultImage, imageComparisonResult.getResult());
}
Expand Down

0 comments on commit 3d9363d

Please sign in to comment.