0

Capture Argument Passed to a mock’s method in Mockito

Capture Argument Sometimes verifying whether or not a method was invoked is not enough.  Some scenarios need verifying values passed to mock object’s methods. To do this, we use:

Here is sample usage:

Download the Codes https://github.com/Turreta/VoidMethodsAndMockito I… Continue Reading

0

JavaScript scope in functions vs Java scope in methods

For years, JavaScript to me was a mere validation tool or script for web applications. I hated it. I avoided using it. This time JavaScript gets the same respect from me as Java does. If you plan to “own” (or master if you can) JavaScript and you are coming from blocked-scoped languages like Java, C#, C and C++, this is one of key things you need to keep in mind… Continue Reading

0

Convenient Way to override equals(), hashCode(), and toString() methods

Two years ago, I used to override the equals() and hashCode() methods via Eclipse’s “Generate hashCode() and equals()…” feature. It proved to be a maintenance nightmare. Every time a new field is added to a class, these methods are updated to include the new instance variable. There is a convenient way to override these methods, toString() included. One that’ll not require subsequent changes when fields are added or remove from a class. Continue Reading