import static org.mockachino.Mockachino.*; public class ExampleTest { public void testExample() { List<String> mockedList = mock(List.class); when(mockedList.size()).thenReturn(2); when(mockedList.get(0)).thenReturn("Mockachino"); assertEquals(2, mockedList.size()); assertEquals("Mockachino", mockedList.get(0)); } } <dependency> <groupId>org.mockachino</groupId> <artifactId>mockachino</artifactId> <version>1.0.0</version> <scope>test</scope> </dependency>


上一篇:
下一篇:
切换中文