package com.branestorm.profiler;

/**
 * This class is used as input to the JReach class to demonstrate how the
 * lines that are never executed are reported.
 *
 * @author  Brian Brane
 */

public class CoverageTester
{
  /** Creates a new instance of CoverageTester */
  public CoverageTester()
  {
  }
  
  public int integerMethod (int arg)
  { return arg+1;
  } // integerMethod
  
  public String stringMethod ()
  { return "test";
  } // stringMethod
  
  public void neverCalled ()
  { int i = 1;
  } // neverCalled
  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args)
  { // Call the integer and string methods several times
    CoverageTester ct = new CoverageTester();
    for (int i = 1; i < 5; i++)
    { ct.integerMethod(i);
      ct.stringMethod();
    }
    
    // Test the THEN and ELSE parts of an IF statement
    boolean first, second;
    first = true; second= false;
    if (first)
    { System.out.println("This statement runs because first is "
      + "true");
    } else
    { System.out.println("This statement is never reached because first is not "
      + "false");
    }
    if (second)
    { System.out.println("This statement is never reached because second"
      + " is not "
      + "true");
    } else
    { System.out.println("This statement runs because second"
      + " is "
      + "false");
    }
    
    // Test assignments within declarations
    int integerMethod1 = ct.integerMethod(1);
    
    String stringMethod1 = "first"
    + "second"
    + "third"; integerMethod1 = 2;
  } // main
  
} // CoverageTester
