/**
 * AddTest.java
 * Show how to use TestNG.
 * @author Xuan Ngo
 */

import org.testng.annotations.Test;           // Import @Test annotattion.
import static org.testng.Assert.assertEquals; // Import assertEquals() method.

public class AddTest
{
  @Test(description="Testing add() method with positive values.")
  public void testAddPositive()
  {
    int iActual = this.add(2, 3);
    int iExpected = 5;
    assertEquals(iActual, iExpected, "add() doesn't return expected positive value.");
  }

  @Test(description="Testing add() method with negative values.")
  public void testAddNegative()
  {
    int iActual = this.add(-2, -3);
    int iExpected = -5;
    assertEquals(iActual, iExpected, "add() doesn't return expected negative value.");
  }
  
  /**
   * I put the implementation of add() here so that the whole test class is self-complete.
   * Usually, this method come from another class so that there is 
   * a complete separation between the test class and the actual class.
   */
  private int add(int a, int b)
  {
    return a+b;
  }
}

