use of org.assertj.core.test.Name in project assertj-core by joel-costigliola.
the class ObjectArrayAssert_extractingResultOf_Test method should_allow_assertions_on_method_invocation_result_extracted_from_given_iterable.
@Test
public void should_allow_assertions_on_method_invocation_result_extracted_from_given_iterable() {
// extract method result
assertThat(jedis).extractingResultOf("age").containsOnly(800, 50);
// extract if method result is primitive
assertThat(jedis).extractingResultOf("darkSide").containsOnly(false, true);
// extract if method result is also a property
assertThat(jedis).extractingResultOf("name").containsOnly(new Name("Yoda"), new Name("Darth Vader"));
// extract toString method result
assertThat(jedis).extractingResultOf("toString").containsOnly("Yoda", "Darth Vader");
}
use of org.assertj.core.test.Name in project assertj-core by joel-costigliola.
the class ObjectArrayAssert_extracting_Test method setUpOnce.
@Before
public void setUpOnce() {
yoda = new Employee(1L, new Name("Yoda"), 800);
luke = new Employee(2L, new Name("Luke", "Skywalker"), 26);
employees = array(yoda, luke);
fellowshipOfTheRing = new TolkienCharacter[8];
fellowshipOfTheRing[0] = TolkienCharacter.of("Frodo", 33, HOBBIT);
fellowshipOfTheRing[1] = TolkienCharacter.of("Sam", 38, HOBBIT);
fellowshipOfTheRing[2] = TolkienCharacter.of("Gandalf", 2020, MAIA);
fellowshipOfTheRing[3] = TolkienCharacter.of("Legolas", 1000, ELF);
fellowshipOfTheRing[4] = TolkienCharacter.of("Pippin", 28, HOBBIT);
fellowshipOfTheRing[5] = TolkienCharacter.of("Gimli", 139, DWARF);
fellowshipOfTheRing[6] = TolkienCharacter.of("Aragorn", 87, MAN);
fellowshipOfTheRing[7] = TolkienCharacter.of("Boromir", 37, MAN);
}
use of org.assertj.core.test.Name in project assertj-core by joel-costigliola.
the class ObjectArrayAssert_extracting_Test method should_allow_assertions_on_field_values_extracted_from_given_iterable.
@Test
public void should_allow_assertions_on_field_values_extracted_from_given_iterable() {
// basic types
assertThat(employees).extracting("id").containsOnly(1L, 2L);
// object
assertThat(employees).extracting("name").containsOnly(new Name("Yoda"), new Name("Luke", "Skywalker"));
// nested property
assertThat(employees).extracting("name.first").containsOnly("Yoda", "Luke");
}
use of org.assertj.core.test.Name in project assertj-core by joel-costigliola.
the class AtomicReferenceArrayAssert_filtered_baseTest method setUp.
@Before
public void setUp() {
yoda = new Employee(1L, new Name("Yoda"), 800);
obiwan = new Employee(2L, new Name("Obi"), 800);
luke = new Employee(3L, new Name("Luke", "Skywalker"), 26);
noname = new Employee(4L, null, 10);
employees = new AtomicReferenceArray<>(new Employee[] { yoda, luke, obiwan, noname });
}
use of org.assertj.core.test.Name in project assertj-core by joel-costigliola.
the class AtomicReferenceArrayAssert_extractingResultOf_Test method setUpOnce.
@BeforeClass
public static void setUpOnce() {
yoda = new FluentJedi(new Name("Yoda"), 800, false);
vader = new FluentJedi(new Name("Darth Vader"), 50, true);
jedis = new AtomicReferenceArray<>(array(yoda, vader));
}
Aggregations