Guest User

Untitled

a guest
Aug 15th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. Should every possible branch in a method have a separate junit?
  2. if (x == 5) {
  3. c = 1;
  4. } else {
  5. if (z != 2) {
  6. b = 6;
  7. } else {
  8. a = 3;
  9. }
  10.  
  11. void testMethod() {
  12. // x is 5
  13. test/assert code;
  14.  
  15. // x not 5, z not 2
  16. test/assert code;
  17.  
  18. // x not 5, z is 2
  19. test/assert code
  20.  
  21. // etc
  22. }
Add Comment
Please, Sign In to add comment