Package org.assertj.core.test

Examples of org.assertj.core.test.Name


  private List<Employee> employees;
  private FieldSupport fieldSupport = FieldSupport.instance();

  @Before
  public void setUpOnce() {
  yoda = new Employee(1L, new Name("Yoda"), 800);
  luke = new Employee(2L, new Name("Luke", "Skywalker"), 26);
  employees = newArrayList(yoda, luke);
  }
View Full Code Here


  assertThat(ages).containsExactly(null, null);

  luke.setName(null);
  list = newArrayList(yoda, luke, null, null);
  Iterable<Name> names = fieldSupport.fieldValues("name", Name.class, list);
  assertThat(names).containsExactly(new Name("Yoda"), null, null, null);
  Iterable<String> firstNames = fieldSupport.fieldValues("name.first", String.class, list);
  assertThat(firstNames).containsExactly("Yoda", null, null, null);
  }
View Full Code Here

  private Employee luke;
  private Iterable<Employee> employees;

  @Before
  public void setUpOnce() {
    yoda = new Employee(6000L, new Name("Yoda"), 800);
    luke = new Employee(8000L, new Name("Luke", "Skywalker"), 26);
    employees = newArrayList(yoda, luke);
  }
View Full Code Here

  private Employee luke;
  private List<Employee> employees;

  @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);
  }
View Full Code Here

  private Employee luke;
  private List<Employee> employees;

  @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);
  }
View Full Code Here

 
  @Test
  public void should_extract_null_valuesfor_null_property_values() {
    yoda.setName(null);
    List<Object> extractedValues = extract(employees, byName("name"));
    assertThat(extractedValues).containsOnly(null, new Name("Luke", "Skywalker"));
  }
View Full Code Here

  }
 
  @Test
  public void should_extract_null_valuesfor_null_field_values() {
    List<Object> extractedValues = extract(employees, byName("surname"));
    assertThat(extractedValues).containsOnly(new Name("Master", "Jedi"), null);
  }
View Full Code Here

  @Test
  public void should_fallback_to_field_if_exception_has_been_thrown_on_property_access() throws Exception {

    List<Employee> employees = Arrays.<Employee>asList(employeeWithBrokenName("Name"));
    List<Object> extractedValues = extract(employees, byName("name"));
    assertThat(extractedValues).containsOnly(new Name("Name"));
  }
View Full Code Here

  @Test
  public void should_prefer_properties_over_fields() throws Exception {
   
    List<Employee> employees = Arrays.<Employee>asList(employeeWithOverridenName("Overriden Name"));
    List<Object> extractedValues = extract(employees, byName("name"));
    assertThat(extractedValues).containsOnly(new Name("Overriden Name"));
  }
View Full Code Here

  }

  // --
 
  private Employee employeeWithBrokenName(String name) {
    return new Employee(1L, new Name(name), 0){
     
      @Override
      public Name getName() {
        throw new IllegalStateException();
      }
View Full Code Here

TOP

Related Classes of org.assertj.core.test.Name

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.