G
grz01
Hi
In JUnit I want to compare an Integer with a Long, as 2 Integers --
say like this:
Integer i = ...;
Long l = ...;
assertEquals(i,l); // assertEquals is ambigous, doesnt work
Now, if I try this instead:
Integer i = ...;
Long l = ...;
assertEquals(i,l.intValue);
assertEquals() still complains it doesnt know whether I mean
assertEquals(int, int) or
assertEquals(Integer, Integer)
Thus, if I write
Integer i = ...;
Long l = ...;
assertEquals(i,(Integer)l.intValue);
it does what I want, but seems a bit verbose with two "casts".
So just wondered, Is there a direct way to go from Long to Integer,
without the intermediate int-step ?
/ grz01
In JUnit I want to compare an Integer with a Long, as 2 Integers --
say like this:
Integer i = ...;
Long l = ...;
assertEquals(i,l); // assertEquals is ambigous, doesnt work
Now, if I try this instead:
Integer i = ...;
Long l = ...;
assertEquals(i,l.intValue);
assertEquals() still complains it doesnt know whether I mean
assertEquals(int, int) or
assertEquals(Integer, Integer)
Thus, if I write
Integer i = ...;
Long l = ...;
assertEquals(i,(Integer)l.intValue);
it does what I want, but seems a bit verbose with two "casts".
So just wondered, Is there a direct way to go from Long to Integer,
without the intermediate int-step ?
/ grz01