mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1784 - Tests related to NPE with IDEA plugin and mockito 3.0.0
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package org.tests.mockito;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.tests.model.aggregation.DOrg;
|
||||
import org.tests.model.basic.PersistentFile;
|
||||
|
||||
public class TestMockitoMock {
|
||||
|
||||
@Test
|
||||
public void mockEntityBean() {
|
||||
|
||||
final DOrg mock = Mockito.mock(DOrg.class);
|
||||
mock.setName("junk");
|
||||
mock.save();
|
||||
|
||||
final PersistentFile mock1 = Mockito.mock(PersistentFile.class);
|
||||
mock1.setName("foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void spyEntityBean() {
|
||||
|
||||
final PersistentFile spy = Mockito.spy(PersistentFile.class);
|
||||
spy.setName("foo");
|
||||
spy.setVersion(42L);
|
||||
|
||||
final PersistentFile verify = Mockito.verify(spy);
|
||||
verify.setName("foo");
|
||||
verify.setVersion(42L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void spyInstanceEntityBean() {
|
||||
|
||||
PersistentFile file = new PersistentFile();
|
||||
final PersistentFile spy = Mockito.spy(file);
|
||||
spy.setName("foo");
|
||||
spy.setVersion(42L);
|
||||
|
||||
final PersistentFile verify = Mockito.verify(spy);
|
||||
verify.setName("foo");
|
||||
verify.setVersion(42L);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user