JUnit - assertSame

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-05-21T13:15:13Z Indexed on 2010/05/21 13:30 UTC
Read the original article Hit count: 126

Filed under:
|
|

Can someone tell me why assertSame() do fail when I use values > 127?

        import static org.junit.Assert.*;

        ...

        @Test
        public void StationTest1() {
          ..

          assertSame(4, 4);         // OK
          assertSame(10, 10);       // OK
          assertSame(100, 100);     // OK
          assertSame(127, 127);     // OK
          assertSame(128, 128);           // raises an junit.framework.AssertionFailedError!
          assertSame(((int) 128),((int) 128)); // also junit.framework.AssertionFailedError!
        }

I'm using JUnit 4.8.1.

© Stack Overflow or respective owner

Related posts about junit

Related posts about junit4