Menu

#5 array equals not work well in jdk5

EasyMock_2.4
closed
EasyMock (40)
5
2012-10-05
2008-06-05
Ryan
No
            jdbcOperations.update(contains("vbb_user"), aryEq(new Object[] {100, 1 }))).andReturn(1);

code like above will be reported not much

cause jdk auto package 100 and 1 to Integer Object

if replace with code below, will fix it.

            jdbcOperations.update(contains("vbb_user"), aryEq(new Object[] {
                    new Integer(100), new Long(1) }))).andReturn(1);

Discussion

  • Henri Tremblay

    Henri Tremblay - 2008-06-09

    Logged In: YES
    user_id=893525
    Originator: NO

    Hi, I did the following which worked fine. Can you give me a failing test case?

    @Test
    public void test() {
        JdbcOperations o = createMock(JdbcOperations.class);
        expect(o.update(contains("vbb_user"), aryEq(new Object[] {100, 1L}))).andReturn(1);        
        replay(o);        
        assertEquals(1, o.update("aaavbb_useraaa", new Object[] { 100, 1L}));        
        verify(o);
    }
    
     
  • Ryan

    Ryan - 2008-06-10

    Logged In: YES
    user_id=1601458
    Originator: YES

    well, i noticed that u use 1L instead of 1
    may be that the reason why i am failed.
    It was not a issue, maybe some addition to the documents..

    Thanks, Henri.

     

Log in to post a comment.

MongoDB Logo MongoDB