@Test
  public void should_return_null_elements_for_null_property_value() {
    List<Employee> list = newArrayList(null, null);
    Iterable<Integer> ages = PropertySupport.instance().propertyValues("ages", Integer.class, list);
    assertThat(ages).containsExactly(null, null);

    list = newArrayList(yoda, luke, null, null);
    ages = PropertySupport.instance().propertyValues("age", Integer.class, list);
    assertThat(ages).containsExactly(800, 26, null, null);
  }
 @Test
 public void should_return_values_of_simple_property_as_objects() {
   Iterable<Integer> ages =
       PropertySupport.instance().propertyValues("age", Integer.class, employees);
   Iterable<Object> agesAsObjects = PropertySupport.instance().propertyValues("age", employees);
   assertEquals(agesAsObjects, ages);
   Iterable<String> firstNames =
       PropertySupport.instance().propertyValues("name.first", String.class, employees);
   Iterable<Object> firstNamesAsObjects =
       PropertySupport.instance().propertyValues("name.first", employees);
   assertEquals(firstNamesAsObjects, firstNames);
 }
  @Test
  public void should_extract_nested_property() {
    String firstName = PropertySupport.instance().propertyValueOf("name.first", String.class, yoda);
    assertThat(firstName).isEqualTo("Yoda");

    yoda.name.first = null;
    firstName = PropertySupport.instance().propertyValueOf("name.first", String.class, yoda);
    assertThat(firstName).isNull();

    yoda.name = null;
    firstName = PropertySupport.instance().propertyValueOf("name.first", String.class, yoda);
    assertThat(firstName).isNull();
  }
 @Test
 public void should_return_values_of_property() {
   List<Long> ids = new ArrayList<Long>();
   ids.add(yoda.getId());
   when(propertySupport.propertyValues(propertyName, Long.class, employees)).thenReturn(ids);
   assertSame(ids, properties.from(employees));
 }
 @Test
 public void should_return_properties_of_inner_class() {
   VehicleFactory vehicleFactory = new VehicleFactory();
   List<String> names =
       PropertySupport.instance()
           .propertyValues("name", String.class, vehicleFactory.getVehicles());
   assertThat(names).containsExactly("Toyota", "Honda", "Audi");
 }
 @Test
 public void should_return_values_of_simple_property() {
   Iterable<Integer> ages =
       PropertySupport.instance().propertyValues("age", Integer.class, employees);
   assertThat(ages).containsExactly(800, 26);
 }
 @Test
 public void should_return_empty_List_if_given_Iterable_is_empty() {
   Iterable<Integer> ages =
       PropertySupport.instance().propertyValues("ages", Integer.class, emptySet());
   assertThat(ages).isEmpty();
 }
 @Test
 public void should_return_property_from_superclass() {
   assertThat(PropertySupport.instance().propertyValues("class", Class.class, employees))
       .containsExactly(Employee.class, Employee.class);
 }
 @Test
 public void should_extract_property() {
   Integer age = PropertySupport.instance().propertyValue("age", Integer.class, yoda);
   assertThat(age).isEqualTo(800);
 }
 @Test
 public void should_throw_error_if_property_not_found() {
   thrown.expect(IntrospectionError.class);
   PropertySupport.instance().propertyValues("foo", Integer.class, employees);
 }
 @Test
 public void should_return_values_of_nested_property() {
   Iterable<String> firstNames =
       PropertySupport.instance().propertyValues("name.first", String.class, employees);
   assertThat(firstNames).containsExactly("Yoda", "Luke");
 }