JMockit - mocked methods in Expectations not returning result

Viewed 1420

JMockit - 1.31

I have the following test method using JUnit (and Groovy):

@Test
void test(@Mocked RequestLine line) {

  new Expectations() {{
    line.getUri()
    result = '123'
  }}

  println line.getUri()

}

line is not null. It is getting an instance. But the problem is that line.getUri() should be returning 123, but is returning null.

Am I doing something wrong? Or should this be working?

UPDATE:

I implemented the test in Java, and it works using result. So it seems to be a problem between JMockit and Groovy.

1 Answers
Related