Upload file using SOA UI This article demonstrates how to upload file to a RESTful web service. Using SoapUI for testing web services may hasten the development of an application since we do not need to wait for a working
Parse CSV file using Apache Commons CSV
Why use CSV files? [wp_ad_camp_5] Sometimes we process data in bulk by reading them from files with specific format like CSV. This article demonstrates how to parse a CSV file using Apache Commons CSV. A CSV is a file format
Group JUnit Test Cases using @Suite.SuiteClasses
Grouping Unit Tests [wp_ad_camp_5] At times there are certain set of unit tests we want to execute automatically. These tests may be critical or have been simply grouped for some reasons. To group JUnit test cases, we use @Suite.SuiteClasses annotation.
Execute Tests in Order in JUnit 4
Using @FixMethodOrder [wp_ad_camp_5] To execute tests in a order in JUnit 4, annotate the class with @FixedMethodOrder passing one of enum MethodSorters items as parameter. Either one of the following can be used are parameter to @FixMethodOrder. MethodSorters.NAME_ASCENDING: This sorts
Mockito Spy
Spy Objects [wp_ad_camp_5] A Mockito spy allows us to create a spy object from a real object with similar behavior where each method can be stubbed out when needed. It is ideal for testing legacy code as you cannot invoke
Find out if an object is a mock or spy in Mockito
The need for it [wp_ad_camp_5] Finding out if an object is a mock or spy in Mockito may not (or never) be part of your usual automated unit tests but in some cases (advanced usage of JUnit/Mockito) you may need
Using JDK 9 with Eclipse Luna
JDK 9 works with Eclipse Mars [wp_ad_camp_5] First and foremost, Eclipse Luna does not work with JDK 9 because of JEP 220: Modular Run-Time Images. There is Eclipse Mars for that. Updating eclipse.ini to use JDK 9 JEP 220 changed
Capture Argument To Method in Mockito
This post shows how to capture arguments our codes passed to a mock’s method. To do this, a method must accept reference types. Then, we use Mockito.verify() method. Then, pass an instance of ArgumentCaptor to the mock’s method. Capture Argument
Inheritance in Object-oriented JavaScript
Inheritance in JavaScript is called prototypal inheritance. Objects inherit from objects. When we create an object from a class, [wp_ad_camp_5]
1 2 3 4 5 6 | function MyClass() { // The class }; var myObject = new MyClass(); |
it always inherits from
1 | MyClass.prototype |
In Java speak, this is like saying “any class inherits from Object class”.
1 2 3 | public class MyClass extends Object { ... } |
Void methods and Mockito in Java
When we talk about unit tests, we think about input values and return values to/from methods. Returned values are checked against expected values as a way to verify behavior of codes. But how would you test codes that do not return any values? Essentially, we resort to stubbing out void methods. That is easy in Mockito!