简体   繁体   中英

How can I replace @MockClass, which was deprecated?

I have code, which is using old version of JMockit library.

@MockClass(realClass = SomeClass.class)
public class MockSomeClass {
    public SomeClass it;

    @Mock
    public void $init(DataSource dataSource) {
        Deencapsulation.setField(it, new MockDataSource());
    }
}

How should I change @MockClass annotation?

public class MockSomeClass extends Mockup<SomeClass>{
    public SomeClass it;

    @Mock
    public void $init(DataSource dataSource) {
        Deencapsulation.setField(it, new MockDataSource());
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM