Top Description Constructors Methods
org.assertj.core.extractor

public Class Extractors

extends Object
Class Inheritance
Static Imports
java.lang.String.format

Extractors factory, providing convenient methods of creating common extractors.

For example:

 assertThat(objectsList).extracting(toStringMethod()).contains("toString 1", "toString 2");
assertThat(objectsList).extracting(byName("field")).contains("someResult1", "someResult2");
Author
Mateusz Haligowski

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Function<Object, Object>

Returns:

the built Function
byName
(String
the name of the field/property to extract
fieldOrProperty
)

Provides extractor for extracting single field or property from any object using reflection

public static Function<Object, Tuple>

Returns:

the built Function
byName
(String...
the name of the fields/properties to extract
fieldsOrProperties
)

Provides extractor for extracting multiple fields or properties from any object using reflection

public static String
extractedDescriptionOf(String... itemsDescription)

public static String
public static String
public static Function<Object, Object>

Returns:

the built Function
resultOf
(String
the name of the method to execute
methodName
)

Provides extractor for extracting values by method name from any object using reflection

public static Function<Object, String>

Returns:

the built Function
toStringMethod
()

Provides extractor for extracting java.lang.Object#toString from any object

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Extractorsback to summary
public Extractors()

Method Detail

byNameback to summary
public static Function<Object, Object> byName(String fieldOrProperty)

Provides extractor for extracting single field or property from any object using reflection

Parameters
fieldOrProperty:String

the name of the field/property to extract

Returns:Function<Object, Object>

the built Function

byNameback to summary
public static Function<Object, Tuple> byName(String... fieldsOrProperties)

Provides extractor for extracting multiple fields or properties from any object using reflection

Parameters
fieldsOrProperties:String[]

the name of the fields/properties to extract

Returns:Function<Object, Tuple>

the built Function

extractedDescriptionOfback to summary
public static String extractedDescriptionOf(String... itemsDescription)
extractedDescriptionOfback to summary
public static String extractedDescriptionOf(Object... items)
extractedDescriptionOfMethodback to summary
public static String extractedDescriptionOfMethod(String method)
resultOfback to summary
public static Function<Object, Object> resultOf(String methodName)

Provides extractor for extracting values by method name from any object using reflection

Parameters
methodName:String

the name of the method to execute

Returns:Function<Object, Object>

the built Function

toStringMethodback to summary
public static Function<Object, String> toStringMethod()

Provides extractor for extracting java.lang.Object#toString from any object

Returns:Function<Object, String>

the built Function