public class Extractors
extends java.lang.Object
For example:
assertThat(objectsList).extracting(toStringMethod()).contains("toString 1", "toString 2");
assertThat(objectsList).extracting(byName("field")).contains("someResult1", "someResult2");
Constructor and Description |
---|
Extractors() |
Modifier and Type | Method and Description |
---|---|
static <F> java.util.function.Function<F,Tuple> |
byName(java.lang.String... fieldsOrProperties)
Provides extractor for extracting multiple fields or properties from any object using reflection
|
static <F> java.util.function.Function<F,java.lang.Object> |
byName(java.lang.String fieldOrProperty)
Provides extractor for extracting single field or property from any object using reflection
|
static java.lang.String |
extractedDescriptionOf(java.lang.Object... items) |
static java.lang.String |
extractedDescriptionOf(java.lang.String... itemsDescription) |
static java.lang.String |
extractedDescriptionOfMethod(java.lang.String method) |
static <F> java.util.function.Function<F,java.lang.Object> |
resultOf(java.lang.String methodName)
Provides extractor for extracting values by method name from any object using reflection
|
static java.util.function.Function<java.lang.Object,java.lang.String> |
toStringMethod()
Provides extractor for extracting
Object.toString() from any object |
public static java.util.function.Function<java.lang.Object,java.lang.String> toStringMethod()
Object.toString()
from any objectFunction
public static <F> java.util.function.Function<F,java.lang.Object> byName(java.lang.String fieldOrProperty)
F
- type to extract property fromfieldOrProperty
- the name of the field/property to extractFunction
public static <F> java.util.function.Function<F,Tuple> byName(java.lang.String... fieldsOrProperties)
F
- type to extract property fromfieldsOrProperties
- the name of the fields/properties to extractFunction
public static <F> java.util.function.Function<F,java.lang.Object> resultOf(java.lang.String methodName)
F
- type to extract property frommethodName
- the name of the method to executeFunction
public static java.lang.String extractedDescriptionOf(java.lang.String... itemsDescription)
public static java.lang.String extractedDescriptionOf(java.lang.Object... items)
public static java.lang.String extractedDescriptionOfMethod(java.lang.String method)