lundi 6 juillet 2015

Testing method for swapping two variables with JUnit

I've got a class with a method for swapping two variables. It returns nothing.

public void swap(int a, int b) {
    a ^= b;
    b = a ^ b;
    a = a ^ b;
}

How can I test it with JUnit? It even doesn't cause any side-effects.

Aucun commentaire:

Enregistrer un commentaire