Skip to content

Commit

Permalink
Fixes #441 : Change return type of Extractors.toStringMethod() to Ext…
Browse files Browse the repository at this point in the history
…ractor<Object, String>
  • Loading branch information
shimikano authored and joel-costigliola committed Jul 4, 2015
1 parent f588104 commit 6464c05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/assertj/core/extractor/Extractors.java
Expand Up @@ -32,7 +32,7 @@ public class Extractors {
/**
* Provides extractor for extracting {@link java.lang.Object#toString} from any object
*/
public static Extractor<?, String> toStringMethod() {
public static Extractor<Object, String> toStringMethod() {
return new ToStringExtractor();
}

Expand Down
Expand Up @@ -13,6 +13,7 @@
package org.assertj.core.api.iterable;

import org.assertj.core.api.AbstractIterableAssert;
import org.assertj.core.extractor.Extractors;
import org.assertj.core.groups.Tuple;
import org.assertj.core.test.Employee;
import org.assertj.core.test.ExpectedException;
Expand Down Expand Up @@ -170,5 +171,12 @@ public Tuple extract(Employee input) {
}
}).containsOnly(tuple("Yoda", 800, 1L), tuple("Luke", 26, 2L));
}

@Test
public void should_allow_extracting_by_toString_method() {
assertThat(employees).extracting(Extractors.toStringMethod()).containsOnly(
"Employee[id=1, name=Name[first='Yoda', last='null'], age=800]",
"Employee[id=2, name=Name[first='Luke', last='Skywalker'], age=26]");
}

}

0 comments on commit 6464c05

Please sign in to comment.