2016-11-01 18:27 GMT+01:00 Attila Magyar <[email protected]>: > > They have strings. And first mock libraries used message names as strings > > They are not the same. Method rename and find senders works with symbols > but > not with strings. Some rarely used refactorings might not work, although > this is probably a technical limitation of the refactoring engine and not a > conceptual one. >
No matter. This is what we have. And with message based approach this problem not exists at all. 2016-11-01 18:27 GMT+01:00 Attila Magyar <[email protected]>: > > not believe that anybody would prefer writing > > In Ruby this would look like something like this. > > allow(socket).to receive(:connect).with(address, port, timeout) { > do_something } > This is exactly what I said: with C-like syntax it is normal but not with keyword messages. > > Not so different and many people use this. Probably lot more than the users > of Mocketry + BabyMock together. > (Anyways probably I wouldn't use a mock library to stub an object like a > socket. It is not my own type, too low-level abstraction. It results > brittle > tests no matter what syntax is used.) It was just example where everybody could see agliness of string based approach. > > > It leads to more code which you will write again and again in your tests > > If I have too many code for setting up expectations and mocks that is a > clear clue that something went wrong in my test, I use mocks in most unit tests. So in every test I will need to repeat all this code. > and I rather have a mock > library that makes this painful early on. It is really easy to make a mess > with mock object based tests. This is why I still prefer jMock over any > other mock object library (mockito, easymock) in Java. JMock is a highly > opinionated library that deliberately doesn't support features like deep > stubbing, partial mocking and other black magic stuffs. BabyMock follows a > similar philosophy. Smalltalk is super powerful language which allows easily create and run tons of spaghetti code. But with C++ it is sometime impossible to just compile spaghetti code. So C++ prevents programmers from writing bad code because without discipline you can't run your program. So if you want to be good programmer choose C++. (sorry for sarcasm)
