title: If statements in tests
body: <p>I have a Parametrized test class with bunch of unit tests that generally control the creation of custom email messages. Right now class has a lot of test which depend on factor(s) used in parametrized class, the flow of the tests is the same for every test. The example of a test:</p>
  
  <pre><code>@Test
  public void testRecipientsCount() {
      assertEquals(3, recipientsCount);
  }
  </code></pre>
  
  <p>I had to add extra funcionality to my email class that adds some extra internal emails to the list of recipients, and that only happens for some of the cases and that leads to my problem.</p>
  
  <p>Lets say I want to assert the amount of messages created. For the old test it was the same for each case, but now its different depending on cases. The most intuitive way for me was to add if statements:</p>
  
  <pre><code>@Test
  public void testRecipientsCount(){
      if(something) {
          assertEquals(3, recipientsCount);
      }
      else {
          assertEquals(4, recipientsCount);
      }
  }
  ...
  </code></pre>
  
  <p>but my more experienced co-worker says we should avoid ifs in test classes (and I kinda agree on that).</p>
  
  <p>I thought that splitting test on two test classess may work, but that would lead to redundant code in both classes (I still have to check if non-iternal messages were created, their size, content etc.), and a few lines added for one of them. </p>
  
  <p>My question is: how do I do this so I don't use if's or loads of redundant code (not using parametrized class would produce even more redundant code)?</p>