Package org.assertj.core.test

Examples of org.assertj.core.test.Name


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


  }

  @Test
  public void should_allow_assertions_on_method_invocation_result_extracted_from_given_iterable_with_enforcing_return_type() throws Exception {
   
    assertThat(jedis).extractingResultOf("name", Name.class).containsOnly(new Name("Yoda"), new Name("Darth Vader"));
  }
View Full Code Here

    }
  };
 
  @Before
  public void setUp() {
    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(employees).as("nested property")
                         .extracting("name.first")
                         .containsOnly("Yoda", "Luke");
    assertThat(employees).as("extract field that is also a property")
                         .extracting("name")
                         .containsOnly(new Name("Yoda"), new Name("Luke", "Skywalker"));
    assertThat(employees).as("extract field that is also a property but specifiying the extracted type")
                         .extracting("name", Name.class)
                         .containsOnly(new Name("Yoda"), new Name("Luke", "Skywalker"));
  }
View Full Code Here

    assertThat(employees).as("extract nested property when top property is null")
                         .extracting("name.first")
                         .containsOnly(null, "Luke");
    assertThat(employees).as("null property")
                         .extracting("name")
                         .containsOnly(null, new Name("Luke", "Skywalker"));
  }
View Full Code Here

                         .extracting("surname")
                         .containsNull();
    assertThat(employees).as("null nested field")
                         .extracting("surname.first")
                         .containsNull();
    yoda.surname = new Name();
    assertThat(employees).as("not null field but null nested field")
                         .extracting("surname.first")
                         .containsNull();
    yoda.surname = new Name("Master");
    assertThat(employees).as("nested field")
                         .extracting("surname.first")
                         .containsOnly("Master", null);
    assertThat(employees).as("extract field specifiying the extracted type")
                         .extracting("surname", Name.class)
                         .containsOnly(new Name("Master"), null);
  }
View Full Code Here

    assertThat(employees).extracting("name", Name.class).usingElementComparator(new Comparator<Name>() {
      @Override
      public int compare(Name o1, Name o2) {
        return o1.getFirst().compareTo(o2.getFirst());
      }
    }).containsOnly(new Name("Yoda"), new Name("Luke", "Skywalker"));
  }
View Full Code Here

  @Rule
  public ExpectedException thrown = none();

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

  }

  @Test
  public void should_allow_assertions_on_property_values_extracted_from_given_iterable_with_extracted_type_defined()
      throws Exception {
    assertThat(employees).extracting("name", Name.class).containsOnly(new Name("Yoda"), new Name("Luke", "Skywalker"));
  }
View Full Code Here

  @Test
  public void should_allow_assertions_on_field_values_extracted_from_given_iterable() throws Exception {
    // 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");
  }
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.