New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cascading issue? #98

Closed
ihoro opened this Issue Nov 6, 2014 · 2 comments

Comments

2 participants
@ihoro
Contributor

ihoro commented Nov 6, 2014

I cannot tell what exactly is a problem here, but in the following example a() and b() are passed but c() fails. If you remove "extends Serializable" then all of them will be passed.
Windows7 x64, OracleJDK 1.8.0_25, TestNG 6.8.8, JMockit 1.13
Any idea what it can be?

package mockit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.Serializable;
import static org.testng.Assert.assertNull;

class Parent<T extends Serializable> {
  private T id;
  public T getId() { return id; }
}
class Foo extends Parent<Long> {}
class Bar extends Parent<Long> {}
interface FooService { Foo getFoo(); }
interface BarService { Bar getBar(); }

public class CascadingTest {
  @Mocked FooService fooService;
  @Mocked BarService barService;

  @BeforeMethod void beforeMethod() {
    new NonStrictExpectations() {{
      barService.getBar();
    }};
  }

  @Test public void a() {
    assertNull(new Foo().getId());
  }

  @Test public void b() {
    new NonStrictExpectations() {{
      fooService.getFoo();
    }};
    assertNull(new Foo().getId());
  }

  @Test public void c() {
    assertNull(new Foo().getId());
  }
}
java.lang.AssertionError: expected [null] but found [java.lang.Long@19b02dfd]
        at mockit.CascadingTest.c(CascadingTest.java:38)
@ihoro

This comment has been minimized.

Show comment
Hide comment
@ihoro

ihoro Nov 6, 2014

Contributor

Tried different JMockit versions:

  • with 1.8 and 1.9 all tests are passed
  • and 1.10 - 1.13 give the same result

@Cascading was used for older versions.

Contributor

ihoro commented Nov 6, 2014

Tried different JMockit versions:

  • with 1.8 and 1.9 all tests are passed
  • and 1.10 - 1.13 give the same result

@Cascading was used for older versions.

@rliesenfeld rliesenfeld added the bug label Nov 6, 2014

@rliesenfeld rliesenfeld self-assigned this Nov 6, 2014

@rliesenfeld

This comment has been minimized.

Show comment
Hide comment
@rliesenfeld

rliesenfeld Nov 6, 2014

Member

Thanks for the report; it appears to be a bug.

Member

rliesenfeld commented Nov 6, 2014

Thanks for the report; it appears to be a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment