Package org.assertj.core.api

Examples of org.assertj.core.api.AssertionInfo


    maps.assertDoesNotContainValue(someInfo(), actual, null);
  }

  @Test
  public void should_fail_if_actual_does_not_contain_value() {
    AssertionInfo info = someInfo();
    String value = "Yoda";
    try {
      maps.assertDoesNotContainValue(info, actual, value);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldNotContainValue(actual, value));
View Full Code Here


    maps.assertContainsOnlyKeys(someInfo(), actual, "color", "name");
  }

  @Test
  public void should_fail_if_actual_contains_unexpected_entry() throws Exception {
    AssertionInfo info = someInfo();
    String[] expectedKeys = { "name" };
    try {
      maps.assertContainsOnlyKeys(info, actual, expectedKeys);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldContainOnlyKeys(actual, expectedKeys, emptySet(), newHashSet("color")));
View Full Code Here

    failBecauseExceptionWasNotThrown(AssertionError.class);
  }

  @Test
  public void should_fail_if_actual_does_not_contains_every_expected_entries() throws Exception {
    AssertionInfo info = someInfo();
    String[] expectedKeys = { "name", "color" };
    @SuppressWarnings("unchecked")
    Map<String, String> underTest = (Map<String, String>) Maps.mapOf(entry("name", "Yoda"));
    try {
      maps.assertContainsOnlyKeys(info, underTest, expectedKeys);
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();
    String[] expectedKeys = { "name", "color" };
    @SuppressWarnings("unchecked")
    Map<String, String> underTest = (Map<String, String>) Maps.mapOf(entry("name", "Yoda"), entry("job", "Jedi"));
    try {
      maps.assertContainsOnlyKeys(info, underTest, expectedKeys);
View Full Code Here

    maps.assertDoesNotContain(someInfo(), null, array(entry("job", "Jedi")));
  }

  @Test
  public void should_fail_if_actual_contains_given_values() {
    AssertionInfo info = someInfo();
    MapEntry[] expected = { entry("name", "Yoda"), entry("job", "Jedi") };
    try {
      maps.assertDoesNotContain(info, actual, expected);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldNotContain(actual, expected, newLinkedHashSet(entry("name", "Yoda"))));
View Full Code Here

    floats.assertLessThan(someInfo(), 6f, 8f);
  }

  @Test
  public void should_fail_if_actual_is_equal_to_other() {
    AssertionInfo info = someInfo();
    try {
      floats.assertLessThan(info, 6f, 6f);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldBeLess(6f, 6f));
      return;
View Full Code Here

    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_fail_if_actual_is_greater_than_other() {
    AssertionInfo info = someInfo();
    try {
      floats.assertLessThan(info, 8f, 6f);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldBeLess(8f, 6f));
      return;
View Full Code Here

    floatsWithAbsValueComparisonStrategy.assertLessThan(someInfo(), 6f, -8f);
  }

  @Test
  public void should_fail_if_actual_is_equal_to_other_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    try {
      floatsWithAbsValueComparisonStrategy.assertLessThan(info, 6f, -6f);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldBeLess(6f, -6f, absValueComparisonStrategy));
      return;
View Full Code Here

    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_fail_if_actual_is_greater_than_other_according_to_custom_comparison_strategy() {
    AssertionInfo info = someInfo();
    try {
      floatsWithAbsValueComparisonStrategy.assertLessThan(info, -8f, 6f);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldBeLess(-8f, 6f, absValueComparisonStrategy));
      return;
View Full Code Here

    maps.assertContainsOnly(someInfo(), actual, entry("name", "Yoda"), entry("color", "green"));
  }

  @Test
  public void should_fail_if_actual_contains_unexpected_entry() throws Exception {
    AssertionInfo info = someInfo();
    MapEntry[] expected = { entry("name", "Yoda") };
    try {
      maps.assertContainsOnly(info, actual, expected);
    } catch (AssertionError e) {
      verify(failures).failure(info,
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.