public class Extractors extends 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> Function<F,Tuple> |
byName(String... fieldsOrProperties)
Provides extractor for extracting multiple fields or properties from any object using reflection
|
static <F> Function<F,Object> |
byName(String fieldOrProperty)
Provides extractor for extracting single field or property from any object using reflection
|
static String |
extractedDescriptionOf(Object... items) |
static String |
extractedDescriptionOf(String... itemsDescription) |
static String |
extractedDescriptionOfMethod(String method) |
static <F> Function<F,Object> |
resultOf(String methodName)
Provides extractor for extracting values by method name from any object using reflection
|
static Function<Object,String> |
toStringMethod()
Provides extractor for extracting
Object.toString() from any object |
public static Function<Object,String> toStringMethod()
Object.toString()
from any objectFunction
public static <F> Function<F,Object> byName(String fieldOrProperty)
F
- type to extract property fromfieldOrProperty
- the name of the field/property to extractFunction
public static <F> Function<F,Tuple> byName(String... fieldsOrProperties)
F
- type to extract property fromfieldsOrProperties
- the name of the fields/properties to extractFunction
public static <F> Function<F,Object> resultOf(String methodName)
F
- type to extract property frommethodName
- the name of the method to executeFunction
Copyright © 2014–2019 AssertJ. All rights reserved.