package edu.pdx.cs410J.student;
import edu.pdx.cs410J.InvokeMainTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.StringContains.containsString;
/**
* Integration tests for the <code>Student</code> class's main method.
* These tests extend <code>InvokeMainTestCase</code> which allows them
* to easily invoke the <code>main</code> method of <code>Student</code>.
*/
public class StudentIT extends InvokeMainTestCase {
@Test
public void invokingMainWithNoArgumentsHasExitCodeOf1() {
InvokeMainTestCase.MainMethodResult result = invokeMain(Student.class);
assertThat(result.getExitCode(), equalTo(1));
}
@Test
public void invokingMainWithNoArgumentsPrintsMissingArgumentsToStandardError() {
InvokeMainTestCase.MainMethodResult result = invokeMain(Student.class);
assertThat(result.getErr(), containsString("Missing command line arguments"));
}
}