mercredi 13 juin 2018

How to unit test Java 8 streams?

list.stream().forEach(e -> { dbCall.delete(e.Id());});

Each item from the list is deleted from the database.

Assuming there were 3 items in the list, how to unit test:

  1. Delete was called 3 times.
  2. Delete was called 'in order/sequence', i.e. sequence of elements in the list?

Aucun commentaire:

Enregistrer un commentaire