org.assertj.swing.assertions
Class ImageAssert

java.lang.Object
  extended by org.assertj.core.api.AbstractAssert<ImageAssert,BufferedImage>
      extended by org.assertj.swing.assertions.ImageAssert
All Implemented Interfaces:
org.assertj.core.api.Assert<ImageAssert,BufferedImage>, org.assertj.core.api.Descriptable<ImageAssert>, org.assertj.core.api.ExtensionPoints<ImageAssert,BufferedImage>

public class ImageAssert
extends org.assertj.core.api.AbstractAssert<ImageAssert,BufferedImage>

Assertion methods for images.

To create an instance of this class, invoke AwtAssertions#assertThat(BufferedImage).

Author:
Yvonne Wang, Alex Ruiz, Ansgar Konermann, Joel Costigliola, Mikhail Mazursky

Field Summary
 
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself
 
Constructor Summary
protected ImageAssert(BufferedImage actual)
           
 
Method Summary
 ImageAssert hasSize(Dimension expected)
          Verifies that the actual image has the given size.
 ImageAssert isEqualTo(BufferedImage expected)
          Verifies that the actual image is equal to the given one.
 ImageAssert isEqualTo(BufferedImage expected, org.assertj.core.data.Offset<Integer> offset)
          Verifies that the actual image is equal to the given one.
 ImageAssert isNotEqualTo(BufferedImage other)
           
 ImageAssert usingComparator(Comparator<? super BufferedImage> customComparator)
           
 ImageAssert usingDefaultComparator()
           
 
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageAssert

protected ImageAssert(BufferedImage actual)
Method Detail

isEqualTo

public ImageAssert isEqualTo(BufferedImage expected)
Verifies that the actual image is equal to the given one. Two images are equal if:
  1. they have equal size
  2. the the RGB values of the color at each pixel are equal

Parameters:
expected - the given image to compare the actual image to.
Returns:
this assertion object.
Throws:
AssertionError - if the actual image is not equal to the given one.

isEqualTo

public ImageAssert isEqualTo(BufferedImage expected,
                             org.assertj.core.data.Offset<Integer> offset)
Verifies that the actual image is equal to the given one. Two images are equal if:
  1. they have the same size
  2. the difference between the RGB values of the color at each pixel is less than or equal to the given offset

Parameters:
expected - the given image to compare the actual image to.
offset - helps decide if the color of two pixels are similar: two pixels that are identical to the human eye may still have slightly different color values. For example, by using an offset of 1 we can indicate that a blue value of 60 is similar to a blue value of 61.
Returns:
this assertion object.
Throws:
NullPointerException - if the given offset is null.
AssertionError - if the actual image is not equal to the given one.

isNotEqualTo

public ImageAssert isNotEqualTo(BufferedImage other)

hasSize

public ImageAssert hasSize(Dimension expected)
Verifies that the actual image has the given size.

Parameters:
expected - the expected size of the actual image.
Returns:
this assertion object.
Throws:
NullPointerException - if the given size is null.
AssertionError - if the size of the actual image is not equal to the given size.

usingComparator

public ImageAssert usingComparator(Comparator<? super BufferedImage> customComparator)
Specified by:
usingComparator in interface org.assertj.core.api.Assert<ImageAssert,BufferedImage>
Overrides:
usingComparator in class org.assertj.core.api.AbstractAssert<ImageAssert,BufferedImage>

usingDefaultComparator

public ImageAssert usingDefaultComparator()
Specified by:
usingDefaultComparator in interface org.assertj.core.api.Assert<ImageAssert,BufferedImage>
Overrides:
usingDefaultComparator in class org.assertj.core.api.AbstractAssert<ImageAssert,BufferedImage>


Copyright © 2014–2015 AssertJ. All rights reserved.