title: JUnit test returning null and false
body: <p>So I am practicing parameterised tests in JUnit. I created this class:</p>
  
  <pre><code>public class Operation {
  
      public Operation() {
  
      }
  
      public int add(int value, int num) {
          int ans = value + num;
          return ans;
      }
  
      public int subtract(int value, int num) {
          int ans = value - num;
          return ans;
      }
  }
  </code></pre>
  
  <p>Nothing special, just some methods to run some tests on.</p>
  
  <p>I have this test class here:</p>
  
  <pre><code>import static org.junit.Assert.*;
  
  import java.util.Arrays;
  import java.util.Collection;
  
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.junit.runners.Parameterized;
  
  @RunWith(Parameterized.class)
  public class OperationTest {
  
      private int value;
      private int num;
  
      public OperationTest(int expected, int value, int num) {
          this.value = value;
          this.num = num;
      }
  
      @Parameterized.Parameters
      public static Collection primeNumbers() {
          return Arrays.asList(new Object[][] {
                  { 4, 2, 2 },
                  { 66, 6, 60 },
                  { 20, 19, 1 },
                  { 82, 22, 50 },
                  { 103, 23, 80 }
          });
      }
  
      @Test
      public void test() {
          Operation o = new Operation();
          assertTrue(value == o.add(value, num));
      }
  
  }
  </code></pre>
  
  <p>finally I have a class to run my tests:</p>
  
  <pre><code>import org.junit.runner.JUnitCore;
  import org.junit.runner.Result;
  import org.junit.runner.notification.Failure;
  
  public class TestRunner {
      public static void main(String[] args) {
          Result result = JUnitCore.runClasses(OperationTest.class);
          for(Failure f : result.getFailures()) {
              System.out.println(f.toString());
          }
  
          System.out.println(result.wasSuccessful());
      }
  }
  </code></pre>
  
  <p>When I run this, the output is:</p>
  
  <pre><code>test[0](OperationTest): null
  test[1](OperationTest): null
  test[2](OperationTest): null
  test[3](OperationTest): null
  test[4](OperationTest): null
  false
  </code></pre>
  
  <p>I am expecting all of them to be true, given that { 4, 2, 2 } means expecting 4 from 2 and 2 which are given as parameters to the add method in the Operation class...I am guessing that this is probably not the right way to do it...</p>
  
  <p>I would be grateful on your insight.</p>