Package org.assertj.core.api

Examples of org.assertj.core.api.AssertionInfo


    failBecauseExceptionWasNotThrown(AssertionError.class);
  }

  @Test
  public void should_fail_if_actual_does_not_contains_every_expected_entries() throws Exception {
    AssertionInfo info = someInfo();
    MapEntry[] expected = { entry("name", "Yoda"), entry("color", "green") };
    Map<?, ?> underTest = Maps.mapOf(entry("name", "Yoda"));
    try {
      maps.assertContainsOnly(info, underTest, expected);
    } catch (AssertionError e) {
View Full Code Here


  }

  @Test
  public void should_fail_if_actual_does_not_contains_every_expected_entries_and_contains_unexpected_one()
      throws Exception {
    AssertionInfo info = someInfo();
    MapEntry[] expected = { entry("name", "Yoda"), entry("color", "green") };
    Map<?, ?> underTest = Maps.mapOf(entry("name", "Yoda"), entry("job", "Jedi"));
    try {
      maps.assertContainsOnly(info, underTest, expected);
    } catch (AssertionError e) {
View Full Code Here

  }

  @Test
  public void should_fail_if_actual_contains_entry_key_with_different_value() throws Exception {

    AssertionInfo info = someInfo();
    MapEntry[] expectedEntries = { entry("name", "Yoda"), entry("color", "yellow") };
    try {
      maps.assertContainsOnly(info, actual, expectedEntries);
    } catch (AssertionError e) {
      verify(failures).failure(
View Full Code Here

    maps.assertHasSameSizeAs(someInfo(), null, array("Solo", "Leia"));
  }

  @Test
  public void should_fail_if_size_of_actual_is_not_equal_to_expected_size() {
    AssertionInfo info = someInfo();
    String[] other = array("Solo", "Leia", "Yoda");
    try {
      maps.assertHasSameSizeAs(info, actual, other);
    } catch (AssertionError e) {
      assertThat(e).hasMessage(shouldHaveSameSizeAs(actual, actual.size(), other.length)
          .create(null, info.representation()));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }
View Full Code Here

    doubles.assertNotEqual(someInfo(), 8d, 6d);
  }

  @Test
  public void should_fail_if_doubles_are_equal() {
    AssertionInfo info = someInfo();
    try {
      doubles.assertNotEqual(info, 6d, 6d);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldNotBeEqual(6d, 6d));
      return;
View Full Code Here

    maps.assertHasSameSizeAs(someInfo(), null, newArrayList("Solo", "Leia"));
  }

  @Test
  public void should_fail_if_size_of_actual_is_not_equal_to_expected_size() {
    AssertionInfo info = someInfo();
    List<String> other = newArrayList("Solo", "Leia", "Yoda");
    try {
      maps.assertHasSameSizeAs(info, actual, other);
    } catch (AssertionError e) {
      assertThat(e).hasMessage(shouldHaveSameSizeAs(actual, actual.size(), other.size())
          .create(null, info.representation()));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }
View Full Code Here

    doublesWithAbsValueComparisonStrategy.assertNotEqual(someInfo(), 8d, 6d);
  }

  @Test
  public void should_fail_if_doubles_are_equal_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    try {
      doublesWithAbsValueComparisonStrategy.assertNotEqual(info, 6d, -6d);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldNotBeEqual(6d, -6d, absValueComparisonStrategy));
      return;
View Full Code Here

    floats.assertIsBetween(someInfo(), ONE, ZERO, ONE);
  }

  @Test
  public void should_fail_if_actual_is_not_in_range_start() {
    AssertionInfo info = someInfo();
    try {
      floats.assertIsBetween(info, ONE, TWO, TEN);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldBeBetween(ONE, TWO, TEN, true, true));
      return;
View Full Code Here

    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_fail_if_actual_is_not_in_range_end() {
    AssertionInfo info = someInfo();
    try {
      floats.assertIsBetween(info, ONE, ZERO, ZERO);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldBeBetween(ONE, ZERO, ZERO, true, true));
      return;
View Full Code Here

    bigDecimals.assertNotEqual(someInfo(), ONE, ONE_WITH_3_DECIMALS);
  }

  @Test
  public void should_fail_if_big_decimals_are_equal() {
    AssertionInfo info = someInfo();
    try {
      bigDecimals.assertNotEqual(info, ONE, ONE);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldNotBeEqual(ONE, ONE));
      return;
View Full Code Here

TOP

Related Classes of org.assertj.core.api.AssertionInfo

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.