Re: Integer / Long comparison



Mike Schilling wrote:
Arne Vajhøj wrote:
Patricia Shanahan wrote:
Even if the value of a Long is supposed to be in the Integer range, a
unit test should check that it is in range, not assume it.
Very relevant point.

It is not good to check if some code is OK by
assuming that the code is OK.

I'm also wondering why Longs and Integers insread of longs and ints. (assertEquals(long, int) would unambiguously call the (long, long) overload).Without seeing the code it's hard to tell, but I wonder if it should be using primitives, but autoboxing had made using objects instead transparent until this cropped up.

Maybe they need to be nullable.

But changing them to simple types would absolute help on the problem.

Arne
.



Relevant Pages

  • Re: Integer / Long comparison
    ... Arne Vajhøj wrote: ... unit test should check that it is in range, ... I'm also wondering why Longs and Integers insread of longs and ints. ...
    (comp.lang.java.programmer)
  • Re: did the multiplication rules change!?
    ... That seems to do the trick. ... >> being multiplied as ints? ... >> assume the Ls tell the JVM to treat them as longs... ... though I'm sure some Usenet/Java zealot will seize this ...
    (comp.lang.java.programmer)
  • Re: did the multiplication rules change!?
    ... >> being multiplied as ints (as opposed to the longs I was expecting)? ... >> assume the Ls tell the JVM to treat them as longs... ... though I'm sure some Usenet/Java zealot will seize this ...
    (comp.lang.java.programmer)
  • Re: What is this?
    ... Hence everything is 4-bytes: chars, ints, longs, floats... ...
    (comp.lang.c)
  • Re: did the multiplication rules change!?
    ... That seems to do the trick. ... > being multiplied as ints? ... > assume the Ls tell the JVM to treat them as longs... ... Prev by Date: ...
    (comp.lang.java.programmer)