Language: Java

import org.hamcrest.core.Is;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import StdInOutStub.StandardInputSnatcher;
import StdInOutStub.StandardOutputSnatcher;
import TestUtil.TestDataFileReader;

public class MainTest
{
	String path = "./src/abc158/b/";
	StandardOutputSnatcher out = new StandardOutputSnatcher();
	StandardInputSnatcher in = new StandardInputSnatcher();
	TestDataFileReader r = new TestDataFileReader(path);

	@Before
	public void before()
	{
		System.setOut(out);
		System.setIn(in);
	}

	@After
	public void after()
	{
		System.setOut(null);
		System.setIn(null);
	}

	private void executeTest(TestDataFileReader r, int caseIndex)
	{
		if (caseIndex < r.getCaseSize()) {
			// 入力
			for (int i=0; i<r.getInputRow(caseIndex); i++) {
				in.inputln(r.getInput(caseIndex, i));
			}
			// テストターゲット実行
			Main.main(null);
			// 期待される出力
			for (int i=0; i<r.getOutputRow(caseIndex); i++) {
				Assert.assertThat(out.readLine(), Is.is(r.getOutput(caseIndex,i)));
			}
		} else {
			Assert.assertTrue(true);
		}
	}

	@Test
	public void testMain1()
	{
		int caseIndex = 0;
		executeTest(r, caseIndex);

	}

	@Test
	public void testMain2()
	{
		int testCase = 1;
		executeTest(r, testCase);
	}

	@Test
	public void testMain3() {
		int testCase = 2;
		executeTest(r, testCase);
	}

	 @Test
	 public void testMain4()
	 {
		int testCase = 3;
		executeTest(r, testCase);
	 }

	  @Test
	  public void testMain5()
	  {
			int testCase = 4;
			executeTest(r, testCase);
	  }
		@Test
		public void testMain6()
		{
			int caseIndex = 5;
			executeTest(r, caseIndex);

		}

		@Test
		public void testMain7()
		{
			int testCase = 6;
			executeTest(r, testCase);
		}

		@Test
		public void testMain8() {
			int testCase = 7;
			executeTest(r, testCase);
		}

		 @Test
		 public void testMain9()
		 {
			int testCase = 8;
			executeTest(r, testCase);
		 }

		  @Test
		  public void testMain10()
		  {
				int testCase = 9;
				executeTest(r, testCase);
		  }
}


Compiler output:
Main.java:11: error: class MainTest is public, should be declared in a file named MainTest.java
public class MainTest
       ^
Main.java:1: error: package org.hamcrest.core does not exist
import org.hamcrest.core.Is;
                        ^
Main.java:2: error: package org.junit does not exist
import org.junit.After;
                ^
Main.java:3: error: package org.junit does not exist
import org.junit.Assert;
                ^
Main.java:4: error: package org.junit does not exist
import org.junit.Before;
                ^
Main.java:5: error: package org.junit does not exist
import org.junit.Test;
                ^
Main.java:7: error: package StdInOutStub does not exist
import StdInOutStub.StandardInputSnatcher;
                   ^
Main.java:8: error: package StdInOutStub does not exist
import StdInOutStub.StandardOutputSnatcher;
                   ^
Main.java:9: error: package TestUtil does not exist
import TestUtil.TestDataFileReader;
               ^
Main.java:14: error: cannot find symbol
	StandardOutputSnatcher out = new StandardOutputSnatcher();
	^
  symbol:   class StandardOutputSnatcher
  location: class MainTest
Main.java:15: error: cannot find symbol
	StandardInputSnatcher in = new StandardInputSnatcher();
	^
  symbol:   class StandardInputSnatcher
  location: class MainTest
Main.java:16: error: cannot find symbol
	TestDataFileReader r = new TestDataFileReader(path);
	^
  symbol:   class TestDataFileReader
  location: class MainTest
Main.java:32: error: cannot find symbol
	private void executeTest(TestDataFileReader r, int caseIndex)
	                         ^
  symbol:   class TestDataFileReader
  location: class MainTest
Main.java:18: error: cannot find symbol
	@Before
	 ^
  symbol:   class Before
  location: class MainTest
Main.java:25: error: cannot find symbol
	@After
	 ^
  symbol:   class After
  location: class MainTest
Main.java:50: error: cannot find symbol
	@Test
	 ^
  symbol:   class Test
  location: class MainTest
Main.java:58: error: cannot find symbol
	@Test
	 ^
  symbol:   class Test
  location: class MainTest
Main.java:65: error: cannot find symbol
	@Test
	 ^
  symbol:   class Test
  location: class MainTest
Main.java:71: error: cannot find symbol
	 @Test
	  ^
  symbol:   class Test
  location: class MainTest
Main.java:78: error: cannot find symbol
	  @Test
	   ^
  symbol:   class Test
  location: class MainTest
Main.java:84: error: cannot find symbol
		@Test
		 ^
  symbol:   class Test
  location: class MainTest
Main.java:92: error: cannot find symbol
		@Test
		 ^
  symbol:   class Test
  location: class MainTest
Main.java:99: error: cannot find symbol
		@Test
		 ^
  symbol:   class Test
  location: class MainTest
Main.java:105: error: cannot find symbol
		 @Test
		  ^
  symbol:   class Test
  location: class MainTest
Main.java:112: error: cannot find symbol
		  @Test
		   ^
  symbol:   class Test
  location: class MainTest
Main.java:14: error: cannot find symbol
	StandardOutputSnatcher out = new StandardOutputSnatcher();
	                                 ^
  symbol:   class StandardOutputSnatcher
  location: class MainTest
Main.java:15: error: cannot find symbol
	StandardInputSnatcher in = new StandardInputSnatcher();
	                               ^
  symbol:   class StandardInputSnatcher
  location: class MainTest
Main.java:16: error: cannot find symbol
	TestDataFileReader r = new TestDataFileReader(path);
	                           ^
  symbol:   class TestDataFileReader
  location: class MainTest
Main.java:40: error: cannot access Main
			Main.main(null);
			^
  bad source file: ./Main.java
    file does not contain class Main
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
Main.java:43: error: cannot find symbol
				Assert.assertThat(out.readLine(), Is.is(r.getOutput(caseIndex,i)));
				^
  symbol:   variable Assert
  location: class MainTest
Main.java:43: error: cannot find symbol
				Assert.assertThat(out.readLine(), Is.is(r.getOutput(caseIndex,i)));
				                                  ^
  symbol:   variable Is
  location: class MainTest
Main.java:46: error: cannot find symbol
			Assert.assertTrue(true);
			^
  symbol:   variable Assert
  location: class MainTest
32 errors