Package org.assertj.core.test

Examples of org.assertj.core.test.Jedi


  private ErrorMessageFactory factory;

  @Test
  public void should_create_error_message_with_all_fields_differences() {
    factory = shouldBeEqualComparingOnlyGivenFields(new Jedi("Luke", "blue"), newArrayList("name", "lightSaberColor"),
                                                    newArrayList((Object) "Luke", "blue"),
                                                    newArrayList((Object) "Yoda", "green"), newArrayList("name",
                                                                                                         "lightSaberColor"));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \n" +
View Full Code Here


                                  "  <[\"name\", \"lightSaberColor\"]>");
  }

  @Test
  public void should_create_error_message_with_single_field_difference() {
    factory = shouldBeEqualComparingOnlyGivenFields(new Jedi("Yoda", "green"), newArrayList("lightSaberColor"),
                                                    newArrayList((Object) "green"), newArrayList((Object) "blue"),
                                                    newArrayList("lightSaberColor"));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \nExpecting value <\"blue\">" +
                                  " in field <\"lightSaberColor\">" +
View Full Code Here

  private ErrorMessageFactory factory;

  @Test
  public void should_create_error_message_with_all_fields_differences() {
    factory = shouldBeEqualToIgnoringGivenFields(new Jedi("Yoda", "blue"), newArrayList("name", "lightSaberColor"),
                                                 newArrayList((Object) "Yoda", "blue"),
                                                 newArrayList((Object) "Yoda", "green"),
                                                 newArrayList("someIgnoredField"));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \n" +
View Full Code Here

                                  "Comparison was performed on all fields but <[\"someIgnoredField\"]>");
  }

  @Test
  public void should_create_error_message_with_single_field_difference() {
    factory = shouldBeEqualToIgnoringGivenFields(new Jedi("Yoda", "blue"), newArrayList("lightSaberColor"),
                                                 newArrayList((Object) "blue"), newArrayList((Object) "green"),
                                                 newArrayList("someIgnoredField"));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \n" +
                                  "Expecting value <\"green\"> in field <\"lightSaberColor\"> " +
View Full Code Here

  }

  @Test
  public void should_create_error_message_with_all_fields_differences_without_ignored_fields() {
    List<String> ignoredFields = newArrayList();
    factory = shouldBeEqualToIgnoringGivenFields(new Jedi("Yoda", "blue"), newArrayList("name", "lightSaberColor"),
                                                 newArrayList((Object) "Yoda", "blue"),
                                                 newArrayList((Object) "Yoda", "green"), ignoredFields);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \nExpecting values:\n" +
                                  "  <[\"Yoda\", \"green\"]>\n" +
View Full Code Here

  }

  @Test
  public void should_create_error_message_with_single_field_difference_without_ignored_fields() {
    List<String> ignoredFields = newArrayList();
    factory = shouldBeEqualToIgnoringGivenFields(new Jedi("Yoda", "blue"), newArrayList("lightSaberColor"),
                                                 newArrayList((Object) "blue"), newArrayList((Object) "green"),
                                                 ignoredFields);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \nExpecting value <\"green\"> " +
                                  "in field <\"lightSaberColor\"> " +
View Full Code Here

*/
public class Objects_assertIsLenientEqualsToByIgnoringNullFields_Test extends ObjectsBaseTest {

  @Test
  public void should_pass_when_fields_are_equal() {
    Jedi actual = new Jedi("Yoda", "Green");
    Jedi other = new Jedi("Yoda", "Green");
    objects.assertIsLenientEqualsToIgnoringNullFields(someInfo(), actual, other);
  }
View Full Code Here

    objects.assertIsLenientEqualsToIgnoringNullFields(someInfo(), actual, other);
  }

  @Test
  public void should_pass_when_some_other_field_is_null_but_not_actual() {
    Jedi actual = new Jedi("Yoda", "Green");
    Jedi other = new Jedi("Yoda", null);
    objects.assertIsLenientEqualsToIgnoringNullFields(someInfo(), actual, other);
  }
View Full Code Here

  }

  @Test
  public void should_fail_if_actual_is_null() {
    thrown.expectAssertionError(actualIsNull());
    Jedi other = new Jedi("Yoda", "Green");
    objects.assertIsLenientEqualsToIgnoringNullFields(someInfo(), null, other);
  }
View Full Code Here

  }

  @Test
  public void should_fail_when_some_actual_field_is_null_but_not_other() {
    AssertionInfo info = someInfo();
    Jedi actual = new Jedi("Yoda", null);
    Jedi other = new Jedi("Yoda", "Green");
    try {
      objects.assertIsLenientEqualsToIgnoringNullFields(info, actual, other);
    } catch (AssertionError err) {
      List<String> emptyList = newArrayList();
      verify(failures).failure(info,
View Full Code Here

TOP

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

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.