import junit.framework.TestCase;
import java.io.*;

/**
 * Reference test class for SecondsToHours.java, for CS139 lab use.
 *
 * @author R.Grove
 * @version 1.0
 */
public class ReferenceTest extends TestCase {
  
  /**
   * Tests the main method of SecondsToHours. System in and out are redirected
   * to local bytes streams. 
   */
  public void testMain() {
    SecondsToHours sth = new SecondsToHours();
    
    String input = "1000\n";
    String expectedOutput = 
        "Enter the number of seconds: " 
        + "\n" 
        + "1000 seconds = 0 hours, 16 minutes, and 40 seconds\n"
        + "\n";
 
    // Set up the input and output streams
    System.setIn(new ByteArrayInputStream(input.getBytes()));
    
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    System.setOut(new PrintStream(output));
    
    // Call the main method with no arguments
    sth.main(new String[] {});
    
    // Verify the output
    assertEquals(expectedOutput, output.toString());   
  }
}