use of org.assertj.core.test.Employee in project assertj-core by joel-costigliola.
the class ByNameMultipleExtractorTest method should_extract_multiple_values_from_maps_by_keys.
@Test
public void should_extract_multiple_values_from_maps_by_keys() {
String key1 = "key1";
String key2 = "key2";
Map<String, Employee> map1 = new HashMap<>();
map1.put(key1, yoda);
Employee luke = new Employee(2L, new Name("Luke"), 22);
map1.put(key2, luke);
Map<String, Employee> map2 = new HashMap<>();
map2.put(key1, yoda);
Employee han = new Employee(3L, new Name("Han"), 31);
map2.put(key2, han);
List<Map<String, Employee>> maps = asList(map1, map2);
assertThat(maps).extracting(key1, key2, "bad key").containsExactly(tuple(yoda, luke, null), tuple(yoda, han, null));
}
use of org.assertj.core.test.Employee in project assertj-core by joel-costigliola.
the class ByNameSingleExtractorTest method should_extract_property_field_combinations.
@Test
public void should_extract_property_field_combinations() {
Employee darth = new Employee(1L, new Name("Darth", "Vader"), 100);
Employee luke = new Employee(2L, new Name("Luke", "Skywalker"), 26);
darth.field = luke;
luke.field = darth;
luke.surname = new Name("Young", "Padawan");
Object extracted = byName("me.field.me.field.me.field.surname.name").extract(darth);
assertThat(extracted).isEqualTo("Young Padawan");
}
use of org.assertj.core.test.Employee in project assertj-core by joel-costigliola.
the class ByNameSingleExtractorTest method should_throw_exception_if_property_cannot_be_extracted_due_to_runtime_exception_during_property_access.
@Test
public void should_throw_exception_if_property_cannot_be_extracted_due_to_runtime_exception_during_property_access() {
thrown.expectIntrospectionError();
Employee employee = new BrokenEmployee();
adultExtractor().extract(employee);
}
use of org.assertj.core.test.Employee in project assertj-core by joel-costigliola.
the class FieldsOrPropertiesExtractor_extract_Test method setUp.
@Before
public void setUp() {
yoda = new Employee(1L, new Name("Yoda"), 800);
yoda.surname = new Name("Master", "Jedi");
luke = new Employee(2L, new Name("Luke", "Skywalker"), 26);
employees = newArrayList(yoda, luke);
}
use of org.assertj.core.test.Employee in project assertj-core by joel-costigliola.
the class FieldsOrPropertiesExtractor_extract_tuples_Test method setUp.
@Before
public void setUp() {
yoda = new Employee(1L, new Name("Yoda"), 800);
yoda.surname = new Name("Master", "Jedi");
luke = new Employee(2L, new Name("Luke", "Skywalker"), 26);
employees = newArrayList(yoda, luke);
}
Aggregations