FEST

assertThat(Integer) automatically unboxes Integers and returns IntAssert

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: FEST-Assert 1.2
  • Fix Version/s: FEST-Assert 1.3
  • Component/s: Assert
  • Labels:
    None
  • Number of attachments :
    0

Description

I would like to assert that Integer instance is null. This however needs nasty workaround:

Integer i = null;
assertThat(i).isNull();		//does not compile
assertThat((Object)i).isNull();

This is because Assertions#assertThat taking Integer instance does automatic unboxing and returns org.fest.assertions.IntAssert instance, that inherits from org.fest.assertions.PrimitiveAssert rather than returning org.fest.assertions.GenericAssert.

Issue Links

Activity

Hide
Ansgar Konermann added a comment -

FEST-133 is the same problem for double.

It's best to implement the solution to this problem for all primitive types in one go, and the progress thereof will be tracked by FEST-133.

Show
Ansgar Konermann added a comment - FEST-133 is the same problem for double. It's best to implement the solution to this problem for all primitive types in one go, and the progress thereof will be tracked by FEST-133.
Hide
Ansgar Konermann added a comment -

Fixed in trunk. Alex is doing some cleanup as part of FEST-260, but this issue is already resolved.

Show
Ansgar Konermann added a comment - Fixed in trunk. Alex is doing some cleanup as part of FEST-260, but this issue is already resolved.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: