2018-03-22-08-29-26-1521707366's People
Forkers
liyanlance xahhy wangleir ssyndrome colining lisu6422 fanksid greenteak kylindc song-nan17 caoxi324 yeland xy-zhou doloresdai kc2a3 itswanglei easterfan sidashen non-computer-training corporatetraining flora-tyh2018-03-22-08-29-26-1521707366's Issues
impossible verification in single link test
Test code:
@Test
public void should_get_element_in_middle_position_in_linkList() {
//获取单链表中的中位数
Integer[] array = new Integer[]{1, 4, 6, 2, 3, 10, 9, 8, 11, 2, 19, 30};
List<Integer> arrayList = Arrays.asList(array);
SingleLink<Integer> singleLink = mock(SingleLink.class);
when(singleLink.getNode(6)).thenReturn(10);
when(singleLink.getNode(7)).thenReturn(9);
Reduce reduce = new Reduce(arrayList);
assertThat(reduce.getMedianInLinkList(singleLink)).isEqualTo(9.5);
verify(singleLink, times(12)).addTailPointer(anyInt());
}
How can singleLink has 12 times interaction with method addTailPointer? SingleLink is an interface which has to be implemented with a new class. so, even you pass mocked singleLink variable into getMedianInLinkList method, it will be replaced with new instance.
so, i think verify(singleLink, times(12)).addTailPointer(anyInt()); makes no sense.
Difference between Method Name and Chinese Annotation
Could someone just explain what the test want to do? It just make me confused when read the method name and chinese annotation. Thank you.
should_return_unrepeated_elements_from_evens
//去除数组中所有偶数组成的数组的重复数
@Test public void should_return_unrepeated_elements_from_evens() { //去除数组中所有偶数组成的数组的重复数 Integer[] array = new Integer[]{1, 2, 3, 4, 1, 5}; List<Integer> arrayList = Arrays.asList(array); Integer[] result = new Integer[]{2, 4}; List<Integer> resultList = Arrays.asList(result); Add add = new Add(); assertThat(add.getUnrepeatedFromEvenIndex(arrayList)).isEqualTo(resultList);
}
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.