freepascal / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

problem with when() using 1.8 rc2 #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This stub causes:

Simple class to mock:
private class TestForMock
{
  public String getValue()
  {
    return "";
  }
}

In JUnit setup method:
TestForMock mockString = Mockito.mock(TestForMock.class);
OngoingStubbing<String> ongoingStub = Mockito.when(mockString.getValue());

This causes:
java.lang.NoSuchMethodError:
org.mockito.Mockito.when(Ljava/lang/Object;)Lorg/mockito/stubbing/OngoingStubbin
g;

We just move to 1.8RC2 to take advantage of ArgumentCaptor.  This is
happening on all OSes - Eclipse 3.5, Java 1.6.

Any help is appreciated.
Jamie

Original issue reported on code.google.com by jamie.do...@gtempaccount.com on 17 Jul 2009 at 2:14

GoogleCodeExporter commented 9 years ago
I cannot seem to reproduce it. Here's my test:

public class PlaygroundTest {

    private class TestForMock
    {
        public String getValue()
        {
            return "";
        }
    }

    @Before
    public void foo() {
        TestForMock mockString = Mockito.mock(TestForMock.class);
        OngoingStubbing<String> ongoingStub = Mockito.when(mockString.getValue());
    }

    @Test
    public void shouldTestSomething() throws Exception {
        Mockito.mock(List.class);
    }
}

it fails with:

UnfinishedStubbingException which is correct behavior.

Was it working for you before moving to 1.8 rc2?

Original comment by szcze...@gmail.com on 17 Jul 2009 at 3:17

GoogleCodeExporter commented 9 years ago
it was working fine in 1.7.  The only thing we changed was the mockito jar that 
we
were pointing to.

It does seem to work in our continuous build with ant without any problems.  
Seems
limited to an issue within our Eclipse environment.

Original comment by jamie.do...@gtempaccount.com on 17 Jul 2009 at 3:33

GoogleCodeExporter commented 9 years ago
>java.lang.NoSuchMethodError:
>org.mockito.Mockito.when(Ljava/lang/Object;)Lorg/mockito/stubbing/OngoingStubbi
ng;

Jamie, I have a feeling that you have more than one mockito jar on your 
classpath.
Can you verify this for me please?

Original comment by szcze...@gmail.com on 19 Jul 2009 at 9:02

GoogleCodeExporter commented 9 years ago
That was it.  The 1.7 jar was still in the directory (although not referenced by
Eclipse). 

Thanks very much for you help.

Original comment by jamiedou...@gmail.com on 20 Jul 2009 at 2:45

GoogleCodeExporter commented 9 years ago
Cool!

Original comment by szcze...@gmail.com on 20 Jul 2009 at 3:00