Class InstanceOfAssertFactory<T,ASSERT extends AbstractAssert<?,?>>

java.lang.Object
org.assertj.core.api.InstanceOfAssertFactory<T,ASSERT>
Type Parameters:
T - the type to use for the cast.
ASSERT - the type of the resulting Assert.
All Implemented Interfaces:
AssertFactory<Object,ASSERT>

public class InstanceOfAssertFactory<T,ASSERT extends AbstractAssert<?,?>> extends Object implements AssertFactory<Object,ASSERT>
AssertFactory decorator which casts the input value to the given type before invoking the decorated AssertFactory.
Since:
3.13.0
Author:
Stefano Cordio
  • Constructor Details

    • InstanceOfAssertFactory

      public InstanceOfAssertFactory(Class<T> type, AssertFactory<T,ASSERT> assertFactory)
      Instantiates a new InstanceOfAssertFactory.
      Parameters:
      type - the Class instance of the given type.
      assertFactory - the AssertFactory to decorate.
  • Method Details

    • createAssert

      public ASSERT createAssert(Object value)
      Creates the custom Assert object for the given element value. Typically this will just invoke assertThat(t)
      Specified by:
      createAssert in interface AssertFactory<T,ASSERT extends AbstractAssert<?,?>>
      Parameters:
      value - the type to convert to an Assert object
      Returns:
      returns the custom Assert object for the given element value
    • toString

      public String toString()
      Overrides:
      toString in class Object